Hello Friends
I was wondering if anyone could help me with the following script. I've list of item numbers. Some items have unwanted prefix attached to them. I have list of unwanted prefixes in a saperate table. I wrote following script. It works for removing the prefixes but it also is giving me item number with prefix in a saperate record. So some of the records are repeating. Following is the script and I am also uploading sample result. I am changing the table names and fields for the sake of simiplicity:
Script:
SELECT DISTINCT [Table1].[Item Number],
IIf(([Table1].[Item Number] Like PrefixQAD.[Item Number] & "*"),Mid([Table1].[Item Number],InStr(1,[Table1].[Item Number],"-")+1,Len([Table1].[Item Number])),[Table1].[Item Number]) AS PrefixRemoved,
FROM [Table1], PrefixQAD;
Following is the result sample:
Item Number Prefix removed
pre-12345 pre-12345
pre-12345 12345
the first record in the result table is an unwanted record. I can't figure out what is causing this record to appear in the result.
Thanks for your time
Rajesh
I was wondering if anyone could help me with the following script. I've list of item numbers. Some items have unwanted prefix attached to them. I have list of unwanted prefixes in a saperate table. I wrote following script. It works for removing the prefixes but it also is giving me item number with prefix in a saperate record. So some of the records are repeating. Following is the script and I am also uploading sample result. I am changing the table names and fields for the sake of simiplicity:
Script:
SELECT DISTINCT [Table1].[Item Number],
IIf(([Table1].[Item Number] Like PrefixQAD.[Item Number] & "*"),Mid([Table1].[Item Number],InStr(1,[Table1].[Item Number],"-")+1,Len([Table1].[Item Number])),[Table1].[Item Number]) AS PrefixRemoved,
FROM [Table1], PrefixQAD;
Following is the result sample:
Item Number Prefix removed
pre-12345 pre-12345
pre-12345 12345
the first record in the result table is an unwanted record. I can't figure out what is causing this record to appear in the result.
Thanks for your time
Rajesh