select distinct ±¾Ô½»Ò×½ð¶î×î¸ß¿¨ºÅ=cardid from transinfo where transmoney= ( select max(transmoney)from transinfo where datediff(day,transdate,getdate()) <=datepart(dd,getdate()) ) and datediff(day,transdate,getdate()) <=datepart(dd,getdate())
——Èç¹ûÖ»ÓÐ1ÈË£¬Ôò¿ÉÒÔ¼ò»¯£º
SQL code: select top 1 cardid from transinfo where datediff(day,transdate,getdate()) <=datepart(dd,getdate()) order by transmoney desc
SQL code: select top 1 cardid,transmoney=sum(transmoney) from tb where datediff(month,transdate,getdate())=0 group by cardid order by sum(transmoney)
year SQL code
Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighligh