SELECT p.productID
, p.name
, p.imageURL
, p.productURL
, p.price
, p.description
, o1.extravalue city
, o2.extravalue region
, o3.extravalue country
FROM wp_tradetracker_store p
LEFT
JOIN wp_tradetracker_extra o1
ON o1.productID = p.productID
AND o1.extrafield = 'city'
LEFT
JOIN wp_tradetracker_extra o2
ON o2.productID = p.productID
AND o2.extrafield = 'region'
LEFT
JOIN wp_tradetracker_extra o3
ON o3.productID = p.productID
AND o3.extrafield = 'country'
Where o1.extravalue = 'Alpe d'Huez'
or o2.extravalue = 'Alpe d'Huez'
GROUP BY productID
order by price asc
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Huez'
or o2.extravalue = 'Alpe d'Huez'
GROUP BY productID
order b...' at line 23