i am trying to execute the distinct records from mysql table having max value of it sno column. I have tried the following query but having no luck.
SELECT DISTINCT p.sno AS sno, p.short_order,p.fir_sno FROM pre_trials p, fir f WHERE p.fir_sno = f.sno GROUP BY p.fir_sno ORDER BY p.sno ASC
For the above query i have the following table:
It should return sno 4,5 because both having the maximum value of sno column. I don't know how to retrieve the record according to my requirements? Any help will be appreciated. thanks
EDIT: Show Create Table fir,pre_trials