Jump to content

[SOLVED] Multi-table SQL question


tarsier

Recommended Posts

I have a simple (in principle) query I am having a hard time getting the working.

I want to select a subset from table1 that does not appear in a subset of another table2

 

table1

--index (primany)

--part_num

--serial_num

 

table2

--index(primary)

--part_num

--file_id

 

I want to select everything from table1 where

  table1.serial_num='1234'  AND

  table1.part_num does not match table2.part_num in the subset of table2 where file_id is not null

 

this is to say that there is a subset in table2 of part_num's that have non-NULL file_id's. I want a list of all table1.part_num's that are not part of this table2 subset and have a given serial number.

 

Does this make sense? Any help would be great.

 

- Dave

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.