MySQL Forums
Forum List  »  Newbie

Re: counting multiple items
Posted by: Peter Brawley
Date: December 06, 2018 03:59PM

Is this what you mean?

select n2997, n1043, n882, n2997+n1043+n882 as sum
from { 
  select 
    sum( if(r.srvno=2997,1,0) )  as n2997,
    sum( if(r.srvno=1043,1,0) )  as n1043,
    sum( if(r.srvno=882, 1,0) )  as n882
  from patient p
  join records r using(patno)
  where r.ssdo=true and r.patno=18025; 
) sums



Edited 2 time(s). Last edit at 12/06/2018 04:04PM by Peter Brawley.

Options: ReplyQuote


Subject
Written By
Posted
December 06, 2018 03:31PM
December 06, 2018 03:33PM
Re: counting multiple items
December 06, 2018 03:59PM
December 07, 2018 06:11AM
December 07, 2018 09:31AM
December 07, 2018 12:35PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.