in reply to Re: How many Select Querie is considered too much?
in thread How many Select Querie is considered too much?
Could be replaced with something like this:SELECT COUNT(*) From Results WHERE user_id = ? AND read = '2' SELECT COUNT(*) From Results WHERE user_id = ? AND read = '3' SELECT COUNT(*) From Results WHERE user_id = ? AND read = '4'
Assuming there are entries for those three values you would get back 3 rows, where column 0 is the 'read' value, and column 1 is the number that had the value.SELECT read, COUNT(*) From Results WHERE user_id = ? AND read in (2,3, +4) GROUP BY read
UPDATE Fixed the query, as TrekNoid pointed out that I omitted the group by clause. Apparently I neglected to select that portion before hitting copy.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How many Select Querie is considered too much?
by TrekNoid (Pilgrim) on Aug 10, 2006 at 21:38 UTC |