MySql Two subrequest count call -


hello guys have trouble code:

select   (select count( * ) _mark_as value =2) bad,  (select count( * ) _mark_as value =1)  `_mark_as` 

what does, count "good" , "bad" values but, call on every entry in _mark_as , it's not right. want make single call return 1 entry with:

# # bad # ############## #  2   #  2  # ############## 

help please.

ps: group not way out. because first done selection (for entries) , applied group by.

select      sum(case when value = 2 1 else 0 end) bad,     sum(case when value = 1 1 else 0 end) _mark_as 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -