Table names must begin with the PrestaShop "_DB_PREFIX_
" prefix.
... FROM `'. _DB_PREFIX_.'customer` ... |
ps_cart
".ps_order
"._lang
" suffix: "ps_product_lang
".Keywords must be written in uppercase.
SELECT `firstname` FROM `'._DB_PREFIX_.'customer` |
Back quotes ("`
") must be used around SQL field names and table names.
SELECT p.`foo`, c.`bar` FROM `'._DB_PREFIX_.'product` p, `'._DB_PREFIX_.'customer` c |
Table aliases have to be named by taking the first letter of each word, and must be lowercase.
SELECT p.`id_product`, pl.`name` FROM `'._DB_PREFIX_.'product` p NATURAL JOIN `'._DB_PREFIX_.'product_lang` pl |
When conflicts between table aliases occur, the second character has to be also used in the name.
SELECT ca.`id_product`, cu.`firstname` FROM `'._DB_PREFIX_.'cart` ca, `'._DB_PREFIX_.'customer` cu |
A new line has to be created for each clause.
$query = 'SELECT pl.`name` FROM `'._DB_PREFIX_.'product_lang` pl WHERE pl.`id_product` = 17'; |
JOIN
in a WHERE
clause.