我想要此记录的最新更新行24763
nc_comment_id nc_id nc_user_id nc_comment_added_by nc_comment nc_comment_added_on
1 24763 2051 Amit sharma nc created 2013-09-23 17:45:00.000
2 24763 2051 Amit Sharma nc updated 2013-09-23 17:45:00.000
44 24763 2051 Pravin NULL 2013-10-22 12:13:48.000
45 24789 2050 Arun nc_created 2013-10-22 12:13:48.000
我希望这条记录带有sql查询
44 24763 2051 Pravin NULL 2013-10-22 12:13:48.000
答案 0 :(得分:2)
对于MSSQL:
SELECT TOP 1 * FROM tablename
WHERE nc_id = 24763
ORDER BY nc_comment_added_on desc
for MySQL:
SELECT * FROM tablename
WHERE nc_id = 24763
ORDER BY nc_comment_added_on desc
LIMIT 1
答案 1 :(得分:1)
尝试以下查询
select top 1 * from tbla where nc_id=24763 order by nc_comment_id desc