I have a question concerning mySQL :
I have two tables.
In the table1, I have these column : idprojet, datedebut, datefin. I have only 5 entries (5 idprojet, 5 datedebut, 5 datefin).
In the table 2, I have the same 5 idprojet, but with various datedebut and various datefin.
I need to fin a way to know if the smaller "datedebut" for each project in table 2 is smaller than the datedebut from table1, and if the biggest "datefin" for each project in table 2 is bigger than the datefin from table2.
I wrote this request to join the tables together with the datas I needed, but I'm stuck there. I don't know if I have to write an IF statement, and if so, what is should look like.. Thanks !
SELECT Table1.idprojet,table1.datedebut, table1.datefin, MIN(table2.dateDEBUT), MAX(table2.dateFIN)
FROM table2 JOIN table1 ON table2.idProjet = table1.idProjet
GROUP BY table2.idProjet
Aucun commentaire:
Enregistrer un commentaire