Skip to main content
added 17 characters in body
Source Link

I need to get the count of a column for a particular id, but only when the column value is "Yes". Following is wrong i guess. mid(PRIMARY KEY)

SELECT COUNT(mt.currentstate = 'Yes') AS currentstate FROM mytable mt WHERE mid = 100 GROUP BY mid; 

For the COUNT value only i need from the column mt.currentstate = 'Yes', but for the ResultSet I need to get all the values where mt.currentstate = 'Yes' or 'No'

I need to get the count of a column for a particular id, but only when the column value is "Yes". Following is wrong i guess. mid(PRIMARY KEY)

SELECT COUNT(mt.currentstate = 'Yes') AS currentstate FROM mytable mt WHERE mid = 100 GROUP BY mid; 

I need to get the count of a column for a particular id, but only when the column value is "Yes". Following is wrong i guess. mid(PRIMARY KEY)

SELECT COUNT(mt.currentstate = 'Yes') AS currentstate FROM mytable mt WHERE mid = 100 GROUP BY mid; 

For the COUNT value only i need from the column mt.currentstate = 'Yes', but for the ResultSet I need to get all the values where mt.currentstate = 'Yes' or 'No'

added 17 characters in body
Source Link

I need to get the count of a column for a particular id, but only when the column value is "Yes". Following is wrong i guess. mid(PRIMARY KEY)

SELECT COUNT(mt.currentstate = 'Yes') AS currentstate FROM mytable mt WHERE mid = 100 GROUP BY mid; 

I need to get the count of a column for a particular id, but only when the column value is "Yes". Following is wrong i guess.

SELECT COUNT(mt.currentstate = 'Yes') AS currentstate FROM mytable mt WHERE mid = 100 GROUP BY mid; 

I need to get the count of a column for a particular id, but only when the column value is "Yes". Following is wrong i guess. mid(PRIMARY KEY)

SELECT COUNT(mt.currentstate = 'Yes') AS currentstate FROM mytable mt WHERE mid = 100 GROUP BY mid; 
Source Link

Get count of a column with a particular value in MySQL

I need to get the count of a column for a particular id, but only when the column value is "Yes". Following is wrong i guess.

SELECT COUNT(mt.currentstate = 'Yes') AS currentstate FROM mytable mt WHERE mid = 100 GROUP BY mid;