[thelist] something wrong with my SQL query

Tom Dell'Aringa pixelmech at yahoo.com
Wed Nov 20 14:01:01 CST 2002


--- rudy <r937 at interlog.com> wrote:
> > >   SELECT count(*) as numberofitems
> > >         FROM menuitem
> > >             WHERE categoryID =  $id

>
> that query will always return exactly one row
> that row will have one column, called numberofitems
> that column will have a value of 0, or some other number
> if it's 0, go ahead and delete the category
>
> rudy

Can you explain it? I don't follow. I realize that AS numberofitems
is a alias that gives you the value of count(*). Thats as far as I
get... I don't follow how its 0 or 1! Especially since there can be
multiple rows of that id...

Tom

=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com



More information about the thelist mailing list