chaking Posted May 12, 2010 Share Posted May 12, 2010 I'm trying to match a few things here and I'm getting a little confused - any help would be appreciated: $s = "SELECT DISTINCT DEVID, INPUTDEVID, MACHINE FROM EVENTS WHERE (EVENT_TIME_UTC BETWEEN '".$start."' AND '".$end."') AND ((EVENTTYPE = 0 AND EVENTID = 0) OR (EVENTTYPE = 4 AND EVENTID IN (2,8,10,53,413,431))) AND (MACHINE = ".$machine.")"; So I'm trying to find any event that has an eventtype of 0 AND an eventid of 0... OR any eventtype of 4 and eventid in (2,8,10,53,413,431). I do NOT want an eventtype of 4 and an eventid of 0. I'm getting a bit confused on how to convey this in the sql statement. I thought I could separate it with parentheses and that would do the trick, but I'm not so sure Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/201435-matching-criterion/ Share on other sites More sharing options...
Brian Swan Posted May 14, 2010 Share Posted May 14, 2010 That query looks like it should give you the results you are looking for. Is it not? Quote Link to comment https://forums.phpfreaks.com/topic/201435-matching-criterion/#findComment-1058554 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.