SELECT distinct T1.nom ,T2.prenom ,T3.telephone ,T4.adresse ,T1.idLink FROM (select distinct idLink,nom from matable x1 where x1.nom IS NOT NULL) T1 ,(select distinct idLink,prenom from matable x2 where x2.prenom IS NOT NULL) T2 ,(select distinct idLink,telephone from matable x3 where x3.telephone IS NOT NULL) T3 ,(select distinct idLink,adresse from matable x4 where x4.adresse IS NOT NULL) T4 where T1.idLink = T2.idLink AND T3.idLink = T2.idLink AND T3.idLink = T4.idLink group by T1.nom
nom prenom telephone adresse idLink
Bey alex NULL france 1
Bey alex NULL NULL 1
Bey alex NULL NULL 1
Bey alexandre NULL NULL 1
nom prenom telephone adresse idLink
Bey alex NULL france 1
Bey alexandre NULL france 1
SELECT CASE WHEN "condition1" THEN "résultat1" WHEN "condition2" THEN "résultat2" ... [ELSE "résultatN"] END FROM "nom de table";
SELECT MAX(nom) AS nom, MAX(prenom) AS prenom, MAX(telephone) AS telephone, MAX(adresse) AS adresse, idLink FROM matable GROUP BY idLink
SELECT MAX(nom) AS nom, MAX(prenom) AS prenom, MAX(telephone) AS telephone, MAX(adresse) AS adresse, idLink FROM matable GROUP BY idLink, nom + prenom HAVING (nom + prenom IS NOT NULL)
nom prenom telephone adresse idLink
Bey alex NULL france 1
Bey alex NULL NULL 1
Bey null 0656 italie 1
Bey alex 0656 NULL 1
nom prenom telephone adresse idLink
Bey alex NULL france 1
Bey alex 0656 italie 1
7 févr. 2014 à 11:59
mais le problème avec cette requête est qu'elle ne retourne pas de résultats lorsque un champ est null partout!!!
7 févr. 2014 à 13:05
Tu peux nous montrer un cas concret ?