1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
SELECT idP as id,
'' AS total_pub,
pseudoP as pseudo, particulier.dateCrea as dateCrea, responsable as resp, '' as nomInsti, adresse as adr, particulier.ville as ville, cp as cp, paysP as pays, tel as tel, '' as fax, mail as mail, '' as site, particulier.type as type, particulier.commentaire as comm, hChaharit as heureC, mChaharit as minC, hMinha as heureM, mMinha as minM, hArvit as heureA, mArvit as minA, 0.1 as inconnu, photoLieu as photo, dateDu as dateDu, dateAu as dateAu, datePour as datePour, str_to_date(particulier.dateCrea, '%d-%m-%Y') as dateTri_fmtdate, rite as rite
FROM particulier
WHERE paysP LIKE '%France%' and particulier.ville LIKE '%Paris%' AND (('2014-06-26' BETWEEN dateDu AND dateAu) OR datePour='2014-06-26')
UNION
// ici exactement la même requete que ci-dessus
SELECT DISTINCT(officiel.idO) as id,
(SELECT IFNULL(SUM(infos_evenement.tarif_pub), 0) FROM infos_evenement WHERE infos_evenement.idO = officiel.idO AND infos_evenement.visible = '1')
+
(SELECT IFNULL(SUM(infos_gala.tarif_pub), 0) FROM infos_gala WHERE infos_gala.idO = officiel.idO AND infos_gala.visible = '1')
+
(SELECT IFNULL(SUM(infos_gan.tarif_pub), 0) FROM infos_gan WHERE infos_gan.idO = officiel.idO AND infos_gan.visible = '1')
+
(SELECT IFNULL(SUM(infos_location.tarif_pub), 0) FROM infos_location WHERE infos_location.idO = officiel.idO AND infos_location.visible = '1')
+
(SELECT IFNULL(SUM(infos_repas.tarif_pub), 0) FROM infos_repas WHERE infos_repas.idO = officiel.idO AND infos_repas.visible = '1')
AS total_pub,
pseudoO as pseudo, officiel.dateCrea as dateCrea, respO as resp, officiel.nomInsti as nomInsti, adrO as adr, officiel.ville as ville, cpO as cp, paysO as pays, telO as tel, faxO as fax, mailO as mail, siteO as site, officiel.type as type, officiel.commentaire as comm, heureCO as heureC, minCO as minC, heureMO as heureM, minMO as minM, heureAO as heureA, minAO as minA, 0.1, photoInstiO as photo, '' as dateDu, '' as dateAu, '' as datePour, str_to_date(officiel.dateCrea, '%d-%m-%Y') as dateTri_fmtdate, riteO as rite
FROM officiel
WHERE paysO LIKE '%France%' and officiel.ville LIKE '%Paris%'
ORDER BY total_pub DESC , nomInsti ASC |
Partager