NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL count( * ) syntax question

Tim Gales tgales at tgaconnect.com
Mon Feb 9 18:48:34 EST 2004


Christopher R. Merlo writes:
"Is there any way to force MySQL to also generate a row if 
 the count is zero?"

You might try adding a 'sentinel' record.
e.g. if you have a table of phone numbers 
with area_code , exchange, and number
you can have a 'sentinel' record at the 
end with an area code of '999'
(that way if you get a count of 1 it means there 
aren't any valid records)

Your processing then has to specifically 
skip the special area code of 999
(not too clean)

you were probably on the right 
track when you said it might be 
time to think things over again.

T. Gales & Associates
'Helping People Connect with Technology'

http://www.tgaconnect.com




More information about the talk mailing list