Hi all,
I am still in the reading stage of SQL programming. There is something that confuses me that I hope somebody on this list can explain. My sources make the following statement:
"Any other columns that appear in the select list must be used as arguments of an aggregate function".
I interpret this to mean that I cannot put columns in the select statement that are not aggregate functions. For example, the following would be invalid:
Select Customer, SaleDate, DateDiff(Day, SaleDate, ShipDate) As DaysToShip, Avg(TotalAmt) as AvgAmt
From Sale
Where Shipdate Is Not Null
Group By SaleDate, DateDiff(Day, SaleDate, ShipDate)
If the above is invalid can somebody explain why there is this limitation in SQL?
TIA!
Rena
I am still in the reading stage of SQL programming. There is something that confuses me that I hope somebody on this list can explain. My sources make the following statement:
"Any other columns that appear in the select list must be used as arguments of an aggregate function".
I interpret this to mean that I cannot put columns in the select statement that are not aggregate functions. For example, the following would be invalid:
Select Customer, SaleDate, DateDiff(Day, SaleDate, ShipDate) As DaysToShip, Avg(TotalAmt) as AvgAmt
From Sale
Where Shipdate Is Not Null
Group By SaleDate, DateDiff(Day, SaleDate, ShipDate)
If the above is invalid can somebody explain why there is this limitation in SQL?
TIA!
Rena