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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query HELP

Status
Not open for further replies.

foxup

Programmer
Dec 14, 2010
328
CA
Hi All,

Simple dbf with 2 fields (num, origin). I need to find the ones that origin = "P" only. P's with not C's. P's can only be alone. Sample dbf and sample result. can it be done in one query?

sample
------
123456789
C​
123456789
P​
587448988
P​
455774441
P​
147477991
C​

result would be
-=-------------
587448988
P​
455774441
P​


please help. Thanks in advance.

FOXUP !
 
Code:
SELECT Table.*;
FROM Table;
LEFT JOIN Table Tbl ON Table.Num = Tbl.Num AND Tbl.Origin = "C";
WHERE Table.Origin = "P" AND Tbl.Num IS NULL

Borislav Borissov
VFP9 SP2, SQL Server
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top