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

check by character 1

Status
Not open for further replies.

dashusa

Programmer
Mar 27, 2006
46
US
Hello im try to match two tables were invoice matches and vendor does not match my code :
SELECT DISTINCT Bb.ID, Bb.Vendor, Bb.Invoice, Bb.Amount, Bb.Code, QB.ID, QB.Date, QB.Invoice, QB.Vendor, QB.Amount, QB.Memo
FROM Bb INNER JOIN QB ON (Bb.Vendor<> QB.Vendor) AND (Bb.Invoice = QB.Invoice);
works but i want to add another check that makes the first 2 letters of vendor from each table match
 
Like this ?
SELECT ...
FROM Bb INNER JOIN QB ON Left(Bb.Vendor,2)=Left(QB.Vendor,2) AND Bb.Invoice=QB.Invoice AND Bb.Vendor<>QB.Vendor;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top