Home > database >  Please help me to optimize the SQL query, the table data
Please help me to optimize the SQL query, the table data

Time:10-24

Based table Grclass GrList Grcode
Glog2 Gdcode, Gdclass Gdate form, large amount of data, may be millions of,
Associated Glog2 GrList based query the latest record
I want to write as follows, what is the efficiency????
Select a. * from Glog2 a inner join (the select Gdclass Gdcode, MAX (Gdate) 'Gdate from Glog2 GROUP BY Gdclass, Gdcode) b
On al-qeada dclass=b.G dclass and al-qeada dcode=b.G dcode and al-qeada date=b.G date left join GrList gl on al-qeada dcode=gl. Grcode and al-qeada dclass=gl. Grclass where gl. Grgroup='G02'
  • Related