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
Post a Comment