Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help building a query script please.....

Status
Not open for further replies.

james0816

Programmer
Jan 9, 2003
295
US
Not sure how to go about this so I'm looking for a little assistance. I am working with two tables. They have common fields (ptnum). I want to display only those records in table one for which there is not a matching record in table two.

Can someone assist me on this? Please let me know if more info is needed.

thx
 
How about:
[tt]
SELECT tbl1.*
FROM tbl1 LEFT JOIN tbl2 USING (ptnum)
WHERE tbl2.ptnum IS NULL
[/tt]
 
unfortunately that didn't get me to where i need to be. let me provide some sample data and see if that will help.

Table1:

ptnum ptsnum catnum description
2041440 1 102509 Part one
2041440 2 103052 Part two
2041440 3 103161 Part thre

Tabel2:

ptnum ptsnum catnum description facnum
2041440 1 102509 Part one 1000

Using the sample data above, I should only be showing the records with ptsnum's 2 and 3.

Hope this helps.
 
Then join using ptsnum instead of ptnum. You did say ptnum originally.
 
i must apologize...that did work (for one part of the equation).

i was focusing on a date range (part two) instead of the lack of records.

looks like its piecing together now....thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top