Skip to content

Select distinct rows where all values are in group

I have a table that stores a one to many relationsion (caseid to code). It is possible for one caseid to have many codes. I would like to select all rows where all the codes for a given caseid are …

SQL Conditional on SELECT Subquery value

I want to apply a condition check on my select subquery. How can I do it optimally? Here’s the initial query: SELECT table1.column1, (SELECT min(table2.column1) FROM table2 WHERE table2.table1Id …

How to compare rows as lists in SQL?

I have a many to many table which has 3 primary keys shown below : table1 : key_1, key_2, key_3 I want to compare rows as lists, For Example : table1 would be : key_1 key_2 key_3 row1: 10 |…