-1

I have this dataset and in the status column, it will return the status of "passed", "failed", or "error". I want to use mysql query to find out how many are -"passed", and how many are "failed". I have two queries that can query the result separately:

(1)

 "select max(build),count(status) as "failed"
    from bioraddash.fullsuite
    where build = 2980 and status = "failed";"

(2)

 "select max(build),count(status) as "passed"
    from bioraddash.fullsuite
    where build = 2980 and status = "passed";"

those queries will return what I want in differnt queries. my question is: how do I combined them so I can get both result in one query and get the result like below:

Maxbuild  passed failed
2980      2      0 

Thanks,

I have no experience on how to combined them, or is it even possible?

danblack
  • 12,130
  • 2
  • 22
  • 41
PChao
  • 417
  • 2
  • 5
  • 17

1 Answers1

0

status="passed" is a true (1) or false (0) expression. Summing them up is equivalent to a count of the expression.

select max(build),sum(status="passed") as "passed", sum(status="failed") as "failed"
    from bioraddash.fullsuite
    where build = 2980
danblack
  • 12,130
  • 2
  • 22
  • 41