I\'m currently working on a report that shows me all post codes covered by our sales team.
Each team covers over 100 post codes. What i would like to do is create a
One of possible solutions. Create a table Prefix(v varchar(4))
where you insert those values. Then a solution would be:
SELECT *
FROM tbl_ClientFile cf
JOIN Prefix p on cf.CLNTPOST1 LIKE p.v + '%'
To exclude duplicates if some prefix includes some another prefix like BB1
, BB10
, BB15
...:
SELECT DISTINCT cf.*
FROM tbl_ClientFile cf
JOIN Prefix p on cf.CLNTPOST1 LIKE p.v + '%'