Hey r937,
Thanks for your reply. Unfortunately, just to make things easier, product codes do not necessarily have 2 letters at the start:
DVD1a
BK2PB
DVD1S
UMW16
are all examples of product ids...
I'm wondering if I should change the table:
Code:
CREATE TABLE `catalogue` (
`prefix` VARCHAR(3) NOT NULL,
`suffix` VARCHAR(5) NOT NULL,
...
PRIMARY KEY(`prefix`, `suffix`)
Then the query would something like:
Code:
SELECT `prefix`+`suffix` AS `id` FROM `catalogue` ORDER BY `prefix` AND `suffix`
What do you think?
Bookmarks