Basically i would like to add a new column in a table entitled product (mainly clothes) which contains 2 columns :
– ProductID (int)
– path (varchar) which is like something |x|y|z| (for example |10|300|5| with 10 indicated that the product is a woman cloth, 300 a t-shirt, and 5 yellow).
So i would like to add a new colum called index in order to allocate in my website a specific place for each products (for example the first picture will be a jean, the second one a coat, the 3rd a t-shirt, etc…). I have 8 zones with the possibility to extend this zone to 8 more, and so on.
I am trying to write an SQL update function such like this :
UPDATE productsTable
SET indexproducts =
SELECT CASE path WHEN path LIKE %|1 for example|%
THEN my index (this index should indicate that the product can be included in the first zone or the 9th zone etc... of my website)
ELSE WHEN path LIKE %|200 for example|%
THEN my index ( for the second zone) ELSE etc?...
END
FROM productsTable.
Any suggestions?
Example syntax: