Jump to content
espacious

Sql poizvedba

Recommended Posts

Pozdravljeni imam nov problem.

Z sql poizvedbami vlečem iz baze vse uporabnike z newsletter=1 država=DE, do tukaj vse ok.

Primer kode:

SELECT DISTINCT a.`id_customer` AS `Customer ID`, `email` AS `e-Mail`, `newsletter_date_add` AS `Newsletter added on:`, cl.`id_country` AS `Country`, a.date_add AS `Account added on:`, a.date_upd AS `Account updated on:`, cl.`name` AS Country FROM `ps_address` a LEFT JOIN `ps_country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = 1) LEFT JOIN `ps_customer` c ON a.id_customer = c.id_customer WHERE 1 AND a.id_customer != 0 AND c.id_shop IN (1) AND `newsletter` = 1 AND ( cl.`id_country` = 1 OR cl.`id_country` = 2) ORDER BY `newsletter_date_add` DESC

Na ta način potegnem iz baze npr. vse EN, vse DE, ter vse FR e-mail naslove. Sem pa opazil ko sem izvozil vse uporabnike da nekateri NIMAJO države. Rad bi z ločeno poizvedbo dobil le te ki nimajo države pa mi nekako ne rata.

Tale del sem poskusil spremenit:

AND ( cl.`id_country` = 1 OR cl.`id_country` = 2) v AND ( cl.`id_country` = ' ') oz AND ( cl.`id_country` = NULL) ampak brez uspeha.

Ima kdo idejo?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More