I want the record whose EmpDate is max but less than @date
You can refer to the following SQL query:
select * from [TableName]
where [EmpDate] = (select max([EmpDate]) from [TableName] where [EmpDate] < @date)
With Regards,
Fei Han
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
504 Points
1776 Posts
Query
Nov 14, 2018 03:57 PM|JagjitSingh|LINK
Hi
I want the record whose EmpDate is max but less than @date
Thanks
All-Star
53081 Points
23648 Posts
Re: Query
Nov 14, 2018 04:23 PM|mgebhard|LINK
See your previous posts as you've asked this question several times. If the solution did not work, provide your current code, schema, and sample data.
All-Star
40565 Points
6233 Posts
Microsoft
Re: Query
Nov 15, 2018 05:29 AM|Fei Han - MSFT|LINK
Hi JagjitSingh,
You can refer to the following SQL query:
With Regards,
Fei Han