Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How I can fetch latest data from my sql as per recent date or id

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;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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
)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading