[thelist] Quick SQL help...

jason.handby jason.handby at corestar.co.uk
Wed Aug 30 18:25:22 CDT 2006


> Take this list of SKU's:
> 
> ABC123
> 
> EPSABC123
> 
> EE442
> 
> DFE332
> 
> EPSDFE332
> 
>  
> 
> Is there an easy way to find a list of SKU's that remotely 
> match another one in the list? The sample result might look like:
> 
>  
> 
> SKU             Match
> 
> ABC123      EPSABC123
> 
> DFE332       EPSDFE332



If you want to match any SKUs that contain the first SKU as a substring,
how about this?

  SELECT P1.SKU, P2.SKU AS Match
	FROM Product P1 INNER JOIN Product P2
	ON P2.SKU LIKE '%' + P1.SKU + '%'
	AND P2.SKU != P1.SKU



Jason



More information about the thelist mailing list