Bonjour,
Voici une requête au format mysql 5.0, où l'on met les nom de table entre paranthèses. Comment faire pour utiliser le mot-clé AS?
j'ai essayé ceci mais cela ne marche pas :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 SELECT ID_USER, LOGIN, PASSWORD, L1.LABEL, L2.LABEL FROM (user, profile, center) INNER JOIN label AS L1 ON (L1.ID_LANG = '1' AND user.ID_PROFILE = profile.ID_PROFILE AND profile.ID_LABEL = L1.ID_LABEL) INNER JOIN label AS L2 ON (user.ID_CENTER = center.ID_CENTER AND L2.ID_LANG = '1' AND center.ID_LABEL = L2.ID_LABEL) UNION SELECT ID_USER, LOGIN, PASSWORD, L1.LABEL, L2.LABEL FROM (user AS U2, profile AS P2) INNER JOIN label AS L3 ON (L3.ID_LANG = '1' AND user.ID_PROFILE = profile.ID_PROFILE AND profile.ID_LABEL = L3.ID_LABEL) LEFT OUTER JOIN center AS C2 ON (C2.ID_CENTER IS NULL) LEFT OUTER JOIN label AS L4 ON (L4.ID_LABEL IS NULL) WHERE user.ID_CENTER IS NULL AND ID_USER <> '1' AND user.ID_PROFILE < 2000 ORDER BY ID_USER
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 SELECT ID_USER, LOGIN, PASSWORD, L1.LABEL, L2.LABEL FROM (user AS U1, profile, center) INNER JOIN label AS L1 ON (L1.ID_LANG = '1' AND user.ID_PROFILE = profile.ID_PROFILE AND profile.ID_LABEL = L1.ID_LABEL) INNER JOIN label AS L2 ON (user.ID_CENTER = center.ID_CENTER AND L2.ID_LANG = '1' AND center.ID_LABEL = L2.ID_LABEL) UNION SELECT ID_USER, LOGIN, PASSWORD, L1.LABEL, L2.LABEL FROM (user AS U2, profile AS P2) INNER JOIN label AS L3 ON (L3.ID_LANG = '1' AND user.ID_PROFILE = profile.ID_PROFILE AND profile.ID_LABEL = L3.ID_LABEL) LEFT OUTER JOIN center AS C2 ON (C2.ID_CENTER IS NULL) LEFT OUTER JOIN label AS L4 ON (L4.ID_LABEL IS NULL) WHERE user.ID_CENTER IS NULL AND ID_USER <> '1' AND user.ID_PROFILE < 2000 ORDER BY ID_USER
Partager