Skip to content
Advertisement

SQL to select the value of a column matching multiple values in another column?

I have a Chat_User join table, and want to retrieve the ChatId of a between specified UserId of x and y.

Chat_User table:

I tried:

But it returns ChatId of a and c, but I only want a, as it has BOTH of my specified UserId(x and y).

Any way to achieve this?

Thanks

Advertisement

Answer

Aggregation offers one approach:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement