I am very confused by your post and am thinking that what I am about to reply is incorrect as seems too simple, but here we go anyway just in case:
SELECT * FROM table_name WHERE pos_id NOT IN (SELECT pos_id FROM position_table)
simplypixie
Practically a Master Poster
642 posts since Oct 2010
Reputation Points: 157
Solved Threads: 118
Skill Endorsements: 5
I looked at your post and couldn't make head nor tail of it. That's why I didn't reply. If I can't understand it, I can't advise as to whether there's a better way to do it. The fact that it's confusing the hell out of me, shouldn't be taken that the post is nonsense - I'm not the sharpest tool in the box!
However, structures should be relatively simple IMO, and this looks pretty convoluted, so I assume from that, that it could be represented / modelled in a more efficient manner.
diafol
Keep Smiling
10,645 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,509
Skill Endorsements: 57
Question Answered as of 5 Months Ago by
diafol,
jkon
and
simplypixie showman13 - In your original post you wrote:
What I need is a way to determine if any of the 9 positions don't exist yet, by virtue of there not being a record in the position table with that pos_id...
And what I posted would do that in the simplest way.
simplypixie
Practically a Master Poster
642 posts since Oct 2010
Reputation Points: 157
Solved Threads: 118
Skill Endorsements: 5
I think we are both confused here. From how I read it you wanted to find all pos_id from one table (I don't know that table name as not provided so I have called it table1) that do not exist in the position_table, in which case your query would be (as I originally put)
SELECT * FROM table1 WHERE pos_id NOT IN (SELECT pos_id FROM position_table)
However, what you have written in the new query is something else and if you already have the numbers you want to check against, you can simply do
SELECT * FROM table1 WHERE pos_id NOT IN (100000014, 100000015, 100000016, 100000017, 100000018, 100000019, 100000020, 100000021, 100000022)
simplypixie
Practically a Master Poster
642 posts since Oct 2010
Reputation Points: 157
Solved Threads: 118
Skill Endorsements: 5