monkeytooth Posted November 19, 2010 Share Posted November 19, 2010 Im trying to build a count for something, and the count works as I would want it to minus one bit. I want the count to exclude specific rows with certain strings in the columns lets say for the sake of easy example.. I have 3 columns, hundreds of rows.. I am grouping my count with the first of 3 columns. The other 2 columns can be just about anything its a varchar column (both). However, there are certain hardcoded defaults I want to exclude from the count if they exist, as they are starter values, person hasn't activated there account or whatever the case may be. So I know in php I can do something like if('thisCol' !== "enter"){count} elseif('thisCol' !== "start"){count} elseif('thisCol2' !== "zero"){count} else{skip} (poor example but you get the idea) Is that something possible to do with a query? I know I can refine my queries WHERE eh="one" AND eh="two" OR fg="three" but what about the opposite of that idea? Plausible? How? Link to comment https://forums.phpfreaks.com/topic/219182-where-clause-confusion/ Share on other sites More sharing options...
mikosiko Posted November 19, 2010 Share Posted November 19, 2010 Is that something possible to do with a query? absolutely... using your example: SELECT count(anything) FROM yourtable WHERE thisCol NOT IN ('enter', 'start', 'zero') GROUP BY whatever Link to comment https://forums.phpfreaks.com/topic/219182-where-clause-confusion/#findComment-1136688 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.