query: select * from ( select * from last_pur where p_date between '01-05-2022' and '31-05-2022' )a Left Join Last_pur as l on l.id=a.id and l.p_date<a.p_date
SELECT x, y, z FROM abc WHERE abc.x BETWEEN a AND b UNION SELECT TOP 1 x, y, z FROM abc WHERE abc.x < a ORDER BY abc.x DESC ORDER BY x
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)