Get latest data from SQL based on date or ID
P粉153503989
P粉153503989 2023-09-16 00:02:05
0
1
632

How to get the latest data from this query, actually the table is crowded and we need the latest data for the past 2 years, how can I modify my query accordingly.

Select stagingScriptDB.*, testBedSuiteMapping.template from stagingScriptDB inner join testBedSuiteMapping on testBedSuiteMapping.id = stagingScriptDB.idScriptDB limit 10;

P粉153503989
P粉153503989

reply all(1)
P粉464113078

It would be great if you share the table structure.

We can use this query type to retrieve the last record of id

SELECT * FROM table_name
WHERE ID IN (
  SELECT max(ID) FROM table_name
  GROUP BY column_name
  ORDER BY column_name
)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template