|
-
September 4th, 2007, 12:46 PM
#1
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????
Rate this post if you found it useful!
10X, gilly914
-
September 5th, 2007, 12:55 AM
#2
Re: GROUP BY returns zero rows...
can u explain ur query like ID is primary key? and ON WHICH COLUMN YOU WANT AVERAGE?
Muhammad Waqas Badar
-
September 5th, 2007, 02:21 AM
#3
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.)
-
September 12th, 2007, 11:50 AM
#4
Re: GROUP BY returns zero rows...
 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|