Ummm...if you can't do it with SQL Server, then I guess he must have been imagining things when he said "Excellent!"
Yes, you can. Yes, it worked.
As he said, the final WORKING form was
SELECT data.part
FROM data,
( SELECT LEFT(part,5) AS prefix, MIN(SUBSTRING(part,6,1) AS subtype, RIGHT(part,3) AS series
FROM data
GROUP BY LEFT(part,5), RIGHT(part,3) ) AS check
WHERE LEFT(data.part,5) = check.prefix AND RIGHT(data.part,3) = check.series
ORDER BY check.prefix, check.subtype, check.series, data.part
Only mistake I made was I'd left a + sign in where the red comma now is.
|