in SQL like this:
[tt]
select AVG(column1), rowID
from myTable
where rowID = 5
group by rowID
[/tt]
the actual query is a big mess so im just trying to show the essential elements here. what i have is an aggregate function and some other row that i am grouping by in the select statement.
in addition to this i want to SORT BY a date, lets say "myDate". each row in this table has a unique myDate, so it seems like SQL is choking on the idea. it only wants aggregate functions and the thing you are grouping by in the select statement.
so what is the workaround to sorting the results after grouping them? i realize the functions are mashing rows together so there is no obvious myDate to sort by, it would have to pick one or know how to pick one... but can anybody offer a possibility for sorting these kinds of results by date, when the date is not the same across each of the grouped rows in the result set? i could take the first date in the group, or the last, doesnt matter, i just need something that will work someway
thanks!
[tt]
select AVG(column1), rowID
from myTable
where rowID = 5
group by rowID
[/tt]
the actual query is a big mess so im just trying to show the essential elements here. what i have is an aggregate function and some other row that i am grouping by in the select statement.
in addition to this i want to SORT BY a date, lets say "myDate". each row in this table has a unique myDate, so it seems like SQL is choking on the idea. it only wants aggregate functions and the thing you are grouping by in the select statement.
so what is the workaround to sorting the results after grouping them? i realize the functions are mashing rows together so there is no obvious myDate to sort by, it would have to pick one or know how to pick one... but can anybody offer a possibility for sorting these kinds of results by date, when the date is not the same across each of the grouped rows in the result set? i could take the first date in the group, or the last, doesnt matter, i just need something that will work someway
thanks!