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
https://forums.phpfreaks.com/topic/52894-solved-multi-table-sql-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.