[thelist] something wrong with my SQL query

rudy r937 at interlog.com
Wed Nov 20 13:31:01 CST 2002


> >   SELECT count(*) as numberofitems
> >         FROM menuitem
> >             WHERE categoryID =  $id
> >
> > this will always return exactly one row, so then you just test the
> > count
>
> Actually, (I probably didn't make this clear) that would return as
> many as there are of that category. There could be 12 items of
> category 'lunch', (id=4 say) and so it would return 12..not one.
> Unless I have completely misunderstood...(which is entirely possible)


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




More information about the thelist mailing list