The following query:
select unnest(Table2.L) as X, unnest(Table1.O)
from Table1, Table2
where Table1.code = Table2.code
order by X ;
produces the desired results. I would, however, like to exclude (unnested) rows which match some value. Adding a condition to the query, such as the following:
and unnest(Table2.L) != '-'
obviously does not work. Is this possible? How?
If by
unnest(Table2.L) != '-'you meanthen use a derived table and filter out the unnested values you don’t want:
If you mean
then you can use the
@>operator to check ifLcontains a certain element:or you could use ANY:
And do yourself a favor by forgetting that implicit joins exist, always use explicit join conditions.