I have the following code
select ID, count(*) from
( select ID, service type from database
group by 1,2) suba
group by 1
having count (*) > 1
And I get a table where i see the IDs and a count of changes. Similar to this
ID | Count(*) 5675 | 2 5695 | 3 5855 | 2 5625 | 4 5725 | 3
Can someone explain to me how to count all the count(*) into groups such that i get a table similar to…
count (*) | number 2 | 2 3 | 2 4 | 1
and so forth. Can someone also explain to be me what suba means?
MY NEWEST CODE:
select suba.id, count(*) from
( select id, service_type from table_name
group by 1,2) as suba
group by 1
having count (*) > 1
Haven’t tried it, but I think this should work
You can think of that as
but subtableb isn’t a real table, but the results from your previous query