Hi Everyone,
I've got a question and I think the answer can be a single SQL statement.
In fact, I think I might've done this before, but I can't find the SQL.
I've got a table with names and different bugs and status ids. I'd like to
get a query that totals the various statuses. For instance, the table is
Name bugid status
Jeff 12 open
Monica 13 new
Jeff 10 closed
George 27 closed
....
and I'd like the output of the query to contain the count of the various
statuses in a single row
Name new open closed
Jeff 10 2 12
Monica 1 3 17
George 12 1 14
.....
I've can't seem to figure out how to aggregate all this properly. Does
anyone have an answer or some pointers?
Thanks!
I've got a question and I think the answer can be a single SQL statement.
In fact, I think I might've done this before, but I can't find the SQL.
I've got a table with names and different bugs and status ids. I'd like to
get a query that totals the various statuses. For instance, the table is
Name bugid status
Jeff 12 open
Monica 13 new
Jeff 10 closed
George 27 closed
....
and I'd like the output of the query to contain the count of the various
statuses in a single row
Name new open closed
Jeff 10 2 12
Monica 1 3 17
George 12 1 14
.....
I've can't seem to figure out how to aggregate all this properly. Does
anyone have an answer or some pointers?
Thanks!
Comment