i am trying to pull data from sql with several conditions from a single column
how can i get this to work?
SELECT RIGHT(productID, 2) AS 'a', SUBSTRING(productID,1,2) AS 'b', productID
FROM products
WHERE `group`='$one'
AND `a` LIKE 'AA%'
AND `b` LIKE '$two'
i am trying to get the first 2 letters of the row and last 2 letters from the same row as well as checking if group=$one but get this error
Unknown column 'b' in 'where clause'
SUBSTRING(productID,1,2)orLEFT(productID,2)since you already used right.... and you have an unmatched ) onright(productID,2)instead ofright(productID),2)