GROUP BY returns zero rows...
I have an sql query that looks like this :
Code:
SELECT table.ID , AVG(*) as AVERAGE , ... , ... from table WHERE X > 200 GROUP BY table.ID ORDER BY AVERAGE
this query qorks great...
everytime there's more than one row in the table, but when theres only one row, it returns zero rows!
I think this is because of the GROUP BY Statement, but im not sure...
How can I prevent this from happening????
Re: GROUP BY returns zero rows...
can u explain ur query like ID is primary key? and ON WHICH COLUMN YOU WANT AVERAGE?
Re: GROUP BY returns zero rows...
It would help if you posted a more complete query. It's obvious that you've removed important things such as joins (or you wouldn't be grouping on an ID.)
Re: GROUP BY returns zero rows...
Quote:
Originally Posted by gilly914
everytime there's more than one row in the table, but when theres only one row, it returns zero rows!
I think this is because of the GROUP BY Statement, but im not sure...
How can I prevent this from happening????
'select' returns Zero rows when 'Where' or 'Having' statements doesn't
find some row.