Jump to content

Sql poizvedba


espacious

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?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...