I have this table. I want to select back the items that don't exist already, so I can create them.
table tags +---------+-------+ | tagId | name | | 1 | C | | 2 | DX | | 3 | CG |
Say SQL looks like:
select name from tags where name in ( 'C', 'CG', 'RX' )
You get back 'C'
and 'CG'
, so you know you have to create 'RX'
.
Is there a way to get a MySQL statement like this to return 'RX'
instead, when 'RX'
doesn't already exist?