drbigfresh Posted January 10, 2008 Share Posted January 10, 2008 I am running the following query: select d_list.listname, d_list.created, d_list.id, (select count(id) from d_list_item where d_list.id=d_list_item.listid) as itemcount from d_list where active='Y' and itemcount >0 order by created desc which works, but it keeps returning items with an itemcount of 0, even though it should only show items with an itemc ount > 0 (all of the itemcount numbers are correct though.) It seems that is is just ignoring the 2nd part of the where clause. I've looked at it for over an hour now, and can't figure it out.... Quote Link to comment https://forums.phpfreaks.com/topic/85444-solved-quick-count-question/ Share on other sites More sharing options...
drbigfresh Posted January 10, 2008 Author Share Posted January 10, 2008 Solved it, it should be: .. where active='Y' having itemcount >0 .... Quote Link to comment https://forums.phpfreaks.com/topic/85444-solved-quick-count-question/#findComment-435990 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.