PDA

View Full Version : Filter by UPC Code



Djblois
02-18-2010, 08:22 AM
I am pulling Product Information from an ODBC connection. It is working perfectly except that I want to filter it down to certain UPC's

Here is my SQL:

SELECT WAVE3_PC_DL.UPC, WAVE3_PRODS.PC, WAVE3_PRODS.PDESC, WAVE3_PC_CATS.CAT_DESC, WAVE3_PC_DL.DEPT, UPC.Date
FROM ((WAVE3_PC_CATS LEFT JOIN WAVE3_PRODS ON WAVE3_PC_CATS.PC_CAT = WAVE3_PRODS.PC_CAT) LEFT JOIN WAVE3_PC_DL ON WAVE3_PRODS.PC = WAVE3_PC_DL.PC) LEFT JOIN UPC ON WAVE3_PRODS.PC = UPC.ITEMNO
ORDER BY WAVE3_PC_DL.UPC;


I want to filter it to only UPC's that begin with "0-71270" and then I only want to show the 8th - 12th digits. I know the first part is possible (and it is more important) but I it would be so useful if I can do the second part also.

CreganTur
02-18-2010, 02:12 PM
You can do both of these easily using text functions in your query. For example:

WHERE LEFT(UPC,7) = "0-71270"

and to show only the 8th - 12th digits, you can create a calculated field using:

Right(Left(UPC,11), 4)

HTH:thumb