I have this requets:
SELECT sc.no, scl.quantite, scl.description, scl.poids, scl.prix, sl_ref.refsl, sl_ref.codetva, sl_ref.tauxtva, sl_ref.compte
FROM shop
SELECT
sc.no
, scl.quantite
, scl.description
, scl.poids
, scl.prix
, sl_ref.refsl
, sl_ref.codetva
, sl_ref.tauxtva
, sl_ref.compte
FROM shop_commande
AS sc, shop_commande_ligne AS scl, selectline_ref AS sl_ref
WHERE sc.id = scl.shop_commande_id
AND sl_ref.refshop = IFNULL(scl.shop_article_id, 0)
AND sc.id NOT IN (SELECT id_command FROM selectline_flag)
I believe you are trying to use the IFNULL()
function. IF you replaced ISNULL
with IFNULL
that should fix your query.
I suggest you go one step further and use COALESCE()
instead of IFNULL()
, since COALESCE()
is part of the SQL standard (and IFNULL()
is not).
SELECT sc.no, scl.quantite, scl.description, scl.poids,
scl.prix, sl_ref.refsl, sl_ref.codetva, sl_ref.tauxtva, sl_ref.compte
FROM shop_commande
AS sc, shop_commande_ligne AS scl, selectline_ref AS sl_ref
WHERE sc.id = scl.shop_commande_id
AND sl_ref.refshop = COALESCE(scl.shop_article_id, 0)
AND sc.id NOT IN (SELECT id_command FROM selectline_flag)