Results 1 to 3 of 3
Mar 31, 2005, 02:59 #1
Combining 2 queries of the same table?
I'm trying to combine 2 statements for a "private messages" feature. The first query gets the number of total messages in their "inbox" and the second query gets the number of messages that haven't been read yet. The two queries are as follows:
SELECT count(*) FROM pms WHERE uid = 'uid'
SELECT count(*) FROM pms WHERE uid = 'uid' AND read = '0'
Ideally, I'd like to query the database all in one pass...and have both numbers contained in the same result. What I'm trying to do is get both numbers in the least amount of database access.
Mar 31, 2005, 03:08 #2
- Join Date
- Jul 2002
- Toronto, Canada
- 52 Post(s)
- 2 Thread(s)
Mar 31, 2005, 03:57 #3