I have this table named tblProduct, which contains fldProductID, fldProductName, fldValue
fldProductName contains its name, and fldValue contains how much is the product cost.
Now I am having trouble with updating fldProductID.
Here's what my fldProductID look like.
Its format is [ProductPrefix][ID]
When ProductPrefix is deleted, all of the productID containing that prefix will be deleted.
For example GZ from ProductPrefix was deleted, GZ01 and GZ02 will be deleted. I don't have a problem with that.
The problem is the Update, when I changed the ProductPrefix, from GZ to GZX, the records from fldProducts will be updated too. GZ01 will become GZX01 and GZ02 will become GZX02.
I have one solution regarding that but it is NOT efficient to use, like if you have thousands of records affected. Each item will be selected by using...
SELECT fldProductID FROM tblProduct GROUP BY fldProductID HAVING MID(fldProductID,1,Len(Prefix)) = 'SOMEVALUE'
... and then will apply the UPDATE query ONE by ONE.
What I am thinking/asking is, is it possible to USE a single line query for this? Like,
UPDATE tblProducts SET fldProductID='<NEWVALUE>' WHERE MID(fldProductID,1,Len(Prefix)) = 'SOMEVALUE'