Skip to content
Advertisement

Select everything that has only one value in a relation

Okay, so here are my tables: tests:

testGroups:

and testGroupAssignments

What I want is to get every test that has group-one assigned to it, given it has no other group assigned to it.

I know that I should use a LEFT JOIN and I tried to do:

Advertisement

Answer

You can try the following:

In case you don’t want to show column values of the other tables you can use the following simple query:

demo on dbfiddle.uk

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