Bonjour,
voici une requête basique avec une jointure qui référence une seconde table mais dont la réponse est vide

Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
SELECT US.US_firstname,US.US_lastname,US.US_sesa FROM LI_license LI
JOIN US_user US ON LI.US_ident = US.US_ident
JOIN usl_user_license USL ON USL.US_ident=US.US_ident
WHERE US.US_sesa = '1'

Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
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
26
27
28
29
30
31
32
CREATE TABLE US_user(
   US_ident INT UNSIGNED AUTO_INCREMENT,
   US_sesa INT,
   US_firstname VARCHAR(50),
   US_lastname VARCHAR(50),
   PRIMARY KEY(US_ident),
   UNIQUE(US_sesa)
);
 
CREATE TABLE USL_user_license(
   US_ident INT UNSIGNED,
   US_ident_manager INT UNSIGNED,
   COU_ident INT UNSIGNED,
   LO_ident INT UNSIGNED,
   CO_ident INT UNSIGNED NOT NULL,
   PRIMARY KEY(US_ident),
   FOREIGN KEY(US_ident) REFERENCES US_user(US_ident),
   FOREIGN KEY(US_ident_manager) REFERENCES USL_user_license(US_ident),
   FOREIGN KEY(COU_ident, LO_ident) REFERENCES LO_location(COU_ident, LO_ident),
   FOREIGN KEY(CO_ident) REFERENCES CO_company(CO_ident)
);
 
CREATE TABLE LI_license(
   LI_ident INT UNSIGNED AUTO_INCREMENT,
   LI_activate_date DATE NOT NULL,
   LI_deactivate_date DATE,
   AP_ident INT UNSIGNED NOT NULL,
   US_ident INT UNSIGNED NOT NULL,
   PRIMARY KEY(LI_ident),
   FOREIGN KEY(AP_ident) REFERENCES AP_application(AP_ident),
   FOREIGN KEY(US_ident) REFERENCES USL_user_license(US_ident)
);

A mon sens, on peut simplifier la requête en :
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
SELECT US.US_firstname,US.US_lastname,US.US_sesa FROM LI_license LI
JOIN US_user US ON LI.US_ident = US.US_ident
WHERE US.US_sesa = '1'
mais ça ne change rien. Quelle serait la bonne requête , SVP ?