Skip to content
Advertisement

Tag: grouping

Dynamically selection of Column Name

I want to select Column Name which has non null and non zero value. So any column name which has 0 or NULL should not be displayed in the output grid I have the Source table as below I want to group by Col1 and Display Col1, MIN(Col2), MIN(Col3), MIN(Col4) and ColRes as (Name of the column with value more

Query Totaling Multiple columns and grouping by another

I am trying to get some totals of multiple records based on Location – but get totals for multiple columns to present back – basically there are various locations and each location has different species and totals at that location. Without doing something really ugly – I have no idea of the best approach – any suggestions? I have a

group rows in plain sql

I have a Table with columns Date and Number, like so: date Number 1-1-2012 1 1-2-2012 1 1-3-2012 2 1-4-2012 1 I want to make a sql query that groups the rows with the same Number and take the minimum date. The grouping only may occur when the value iof Number is the same as previous / next row. So

Advertisement