SELECT p.productID , , 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 = 'La Chapelle d'Abondance' or o2.extravalue = 'La Chapelle d'Abondance' 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 'Abondance' or o2.extravalue = 'La Chapelle d'Abondance' GROUP BY produ...' at line 23