oracle - Trying to take count results and give them their own column -
i making first post here since have not been able find solution on own. have little programming/sql/oracle knowledge, work (i believe) oracle databases.
what trying accomplish taking query result , giving each count() own column. reason make report web application. need results fill column of own in order parse out fields report designer.
my query looks following:
select issue, count(issue) issue_count issue_table time >to_date('08/10/2017 00:00:00','mm/dd/yyyy hh24:mi:ss') , time <to_date('08/11/2017 00:00:00','mm/dd/yyyy hh24:mi:ss') group issue
this return result follows:
issue | issue_count ------------------------ | 30 b | 4 c | 24 d | 17
what i'd end this:
issue | | b | c | d | ---------------------------------- issue_count | 30 | 4 | 24 | 17 |
i need ensure each issue_count unique in own column or report application not parse out results display when reports run. thought using pivot, have not found solution uses count() or sum().
you need use pivot
clause. try query:
select * (select issue, count(issue) issue_count issue_table time >to_date('08/10/2017 00:00:00','mm/dd/yyyy hh24:mi:ss') , time <to_date('08/11/2017 00:00:00','mm/dd/yyyy hh24:mi:ss') group issue )pivot (sum(issue_count) issue in ('a','b','c','d'))
Comments
Post a Comment