如何在SQL Server 2005中记录某些记录? [英] How to take certain records in SQL server 2005?

查看:102
本文介绍了如何在SQL Server 2005中记录某些记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



Iam使用Sql Server2005.

Iam拿一张桌子,上面扫描了员工卡的详细信息.

对于特定日期,我有多个条目.

谁能解释如何仅获取两个日期和特定日期的条目
记录两个日期之间的所有详细信息


问候
Nirmala Saravanan



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

推荐答案

select top(2)* from TableName where Date = particular Date


如果单个日期可以有多个条目,并且只想列出其中的2条,那么您应该解释从同一日期的所有可能记录中选择这2条记录的标准.

要从两个日期之间的表中选择所有记录,可以使用BETWEEN.例如
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
SELECT * FROM TableName WHERE DateColumn BETWEEN @date1 AND @date2


这篇关于如何在SQL Server 2005中记录某些记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆