cooldude832 Posted October 13, 2007 Share Posted October 13, 2007 I'm trying to do a query with a structure like select count(*) as "id_count" From `Facilitators` Where Location = 'Michigan' and Type = '5' or Type ='1' or Type = '3' or Type = '7' and Active = '1' However using all those Ors on the Type is making the rest of the query meaningless. How can I get the desired result without kliling the rest of my where? I want to find from the table wehre Location is Michigan and Type is 1 or 3 or 5 or 7 and Active is 1, but right now it returns any resutls that have a valid tyep Quote Link to comment https://forums.phpfreaks.com/topic/73099-solved-mysql-php-operators-in-a-query/ Share on other sites More sharing options...
esukf Posted October 13, 2007 Share Posted October 13, 2007 Try select count(*) as "id_count" From `Facilitators` Where Location = 'Michigan' and (Type = '5' or Type ='1' or Type = '3' or Type = '7') and Active = '1' Quote Link to comment https://forums.phpfreaks.com/topic/73099-solved-mysql-php-operators-in-a-query/#findComment-368657 Share on other sites More sharing options...
cooldude832 Posted October 13, 2007 Author Share Posted October 13, 2007 i'll try that thanks Quote Link to comment https://forums.phpfreaks.com/topic/73099-solved-mysql-php-operators-in-a-query/#findComment-368658 Share on other sites More sharing options...
cooldude832 Posted October 13, 2007 Author Share Posted October 13, 2007 It actually made no difference between it, I didn't realize my active field had a bunch of inactive active =0 rows Quote Link to comment https://forums.phpfreaks.com/topic/73099-solved-mysql-php-operators-in-a-query/#findComment-368663 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.