How to I get latest data from this query, actually the table is hudge we need recent data from past 2 year, how can I modify my query accordigly.
select stagingScriptDB.*, testBedSuiteMapping.template from stagingScriptDB inner join testBedSuiteMapping on testBedSuiteMapping.id = stagingScriptDB.idScriptDB limit 10;
CodePudding user response:
If you shared the table structure it will be good.
we can use this query type to retrieve last record for id
SELECT * FROM table_name WHERE ID IN ( SELECT max(ID) FROM table_name GROUP BY column_name ORDER BY column_name )