S
S
Steve2020-02-18 22:22:00
SQL
Steve, 2020-02-18 22:22:00

How to find owners who own more than one apartment in the same building?

Is there a table on how to find owners who own more than one apartment in the same building?
id|flat_num|house_id|owner_id|
1|12 |2 |1 |
2|22 |3 |3 |
3|10 |3 |3 |
4|30 |1 |2 |
5|12 |2 |4 |
6|22 |3 |4 |

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Melnikov, 2020-02-18
Gorton

SELECT owner_id FROM t1
GROUP BY owner_id, house_id 
HAVING count(owner_id, house_id) > 1;

F
felony13twelve, 2020-02-18
@felony13twelve

poke

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question