Sunday, 15 May 2011

mysql - SQL query and SELECT -


I want to select some datas from several tables, but I can see my limitations in SQL. MySQL returns with my query here:

  | IdCandidate | Date | Hour | Name operator 758 | 04/30/2015 | 15h00 | BRYAN 856 | 04/30/2015 | 17h20 | BRYAN 20 | 04/03/2015 | 15h30 | BRYAN 956 | 05/01/2015 | 11h00 | Karl 758 | 05/01/2015 | 10h20 | CARL  

But I want the last place of every teacher's day: for Brillon 17h20, for CARL 11h00

I think I can make it a selector I ... from ... WHERE IN (....) But is there a more "beautiful" way?

Thank you.

Use a correlated sub-query to get the latest lessons of each day / teacher: / P>

  idCandidate, date, hour, name selector from TablelineNum T1 = Hourly (select maximum (hour) from Tblename T2 where t1.date = t2.date and t1.NameOfTeacher = t2.NameOfTeacher)  

No comments:

Post a Comment