I'm trying to return several pieces of information from a small table.

Table is 'tickets':

   id        CHAR(50)
   group     CHAR(50)
   issued    DATE
   used      DATE

'issued' and 'used' are NULL until a date is entered.  The found set 
is generally based on the 'group'.

I want the actual number of records in a found set - COUNT(*) is easy 
- but I also want the number of tickets that exist but which have not 
been issued, and the number that HAVE been issued but have not been 
used.

In looking via SELECT * FROM tickets, the DATE fields are NULL if 
nothing is actually entered into them.


I've tried SELECT COUNT(*), COUNT(ISSUED IS NULL) as notissued... etc

and other variations, but I always get the count for the total (*) 
and for the issued field being the same.  I expect that this is 
because COUNT is counting the total number of found records, but I'm 
not sure.

How can I get the numbers I'm interested in?

Thanks,
Nelson

-- 

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to