Link to home
Start Free TrialLog in
Avatar of hojohappy
hojohappy

asked on

SQL Select Command to do a partial match

I need a SQL Select command that can to do a partial match. I need match the first a NBR to the first 10 digits of another number. For example:

ItemID= 10 digits long
EAN11 = 11 digits long.

I need to match STEPUPC.ItemID to the first 10 digits of the SAPMATUPC.EAN11.

SELECT *
FROM STEPUPC
WHERE NOT EXISTS
(SELECT SAPMATUPC.EAN11
FROM SAPMATUPC WHERE STEPUPC.ItemID = SAPMATUPC.EAN11
Avatar of Aneesh
Aneesh
Flag of Canada image

SELECT *
FROM STEPUPC
WHERE NOT EXISTS
(SELECT SAPMATUPC.EAN11
FROM SAPMATUPC WHERE STEPUPC.ItemID = LEFT(SAPMATUPC.EAN11 ,10) )
ASKER CERTIFIED SOLUTION
Avatar of Lowfatspread
Lowfatspread
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial