Skip to content
Advertisement

Conditional Postgres Query

The PG table looks like this:

I would like to write a query that only lists rows in which Name has a ‘Type A’ record but not a Type B record.

This is the result I am hoping for:

Advertisement

Answer

You can use a nested select:

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