oracle - SQL: MAX(id) in where clause subquery with group by -
i have query , subquery in query, should give string of dates of different rows in group (group by).
this works:
want string in report other rows same max(id) because can't use max(inner.id) min(outer.id) in clause of inner query don't know how that, suggestion?
my code (simple version):
select (select listagg(to_timestamp('1970/01/01 00:00:00 ', 'yyyy/mm/dd hh24:mi:ss') + timestamp/86400, ', ') within group (order id) timestamps tbl inner max(inner.id) max(outer.id) , mrdin.timestamp between time , time group customer having count (2) > 1) alias tbl outer timestamp between time , time group customer;
i want strings (timestamp) of first picture in dates column of second picture using max(id) of both compare. can't because of can't user max() function in clausule of inner select.
i don't understand trying do, work you?
select (select listagg(to_timestamp('1970/01/01 00:00:00 ', 'yyyy/mm/dd hh24:mi:ss') + timestamp/86400, ', ') within group (order id) timestamps tbl inner , inner.timestamp between time , time group customer having count (2) > 1 , max(inner.id) = outer_id ) alias ( select max(id) outer_id tbl outer timestamp between time , time group customer );
Comments
Post a Comment