Click here to Skip to main content
15,902,276 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,

Iam using Sql server 2005.

Iam taking a table having details of employee card scanned.

For particular date i have multiple entries.

can anyone explain how to get only two entries for particular date and
taking all the details between two dates


regards
Nirmala Saravanan
Posted

SQL
select top(2)* from TableName where Date = particular Date
 
Share this answer
 
v4
If you can have multiple entries for a single date and you want to have only 2 of those listed, then you should explain what is the criteria for selecting those 2 records from all the possible records for the same date.

To select all records from a table between two dates, you can use BETWEEN. For example
SQL
SELECT * FROM TableName WHERE DateColumn BETWEEN @date1 AND @date2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900