ÇóÒ»ÌõSQLÓï¾ä¡£
ID ²Í±ð ʱ¼ä
1 ÖÐ²Í 2009-10-25
2 ÖÐ²Í 2009-10-26
3 Íí²Í 2009-10-26
4 Ôç²Í 2009-10-27
½á¹û
1 ÖÐ²Í 2009-10-25
3 Íí²Í 2009-10-26
4 Ôç²Í 2009-10-27
ÈÕÆÚÖÐÓÐÖظ´µÄ¡£¡£ÎÒÏëÒ»Ö±µÃµ½×îеġ£¡£°ïæллÁË
ËäÈ»¶Ô´ó¼ÒÓÐЩ¼òµ¥¡£µ«ÊÇÓÐûÓоµäµÄË㷨ѽ¡£
ÕâÖÖÎÊÌâÔÚ±¨±íÖÐ×ÜÊdzöÏÖ¡£¡£
UP
SQL code:
select * from tb a where not exists(select 1 from tb where a.²Í±ð=²Í±ð and a.ʱ¼ä<ʱ¼ä)
SQL code:
--> ²âÊÔÊý¾Ý: @T1
declare @T1 table (ID int,²Í±ð varchar(4),ʱ¼ä datetime)
insert into @T1
select 1,'ÖвÍ','2009-10-25' union all
select 2,'ÖвÍ','2009-10-26' union all
select 3,'Íí²Í','2009-10-26' union all
select 4,'Ôç²Í','2009-10-27'
select * from @t1 a where not exists(select 1 from @t1 where a.²Í±ð=²Í±ð and a.ʱ¼ä> ʱ¼ä)
ID ²Í±ð ʱ¼ä
----------- ---- ------------------------------------------------------
1 ÖÐ²Í 2009-10-25 00:00:00.000
3 Íí²Í 2009-10-26 00:00:00.000
4 Ôç²Í 2009-10-27 00:00:00.000
£¨ËùÓ°ÏìµÄÐÐÊýΪ 3 ÐУ©
3Â¥Óеã´íÎó
SQL code
{{-
Ïà¹ØÎÊ´ð£º
sql table±íÓиöÎı¾ÀàÐ͵Äa×ֶΣ¬´æ´¢µÄÄÚÈÝÈ«²¿ÊÇÊý×Ö£¬ÀýÈç2009001£¬2008578ÕâÑùµÄ¸ñʽ£»b×Ö¶ÎÎı¾ÀàÐÍ£¬´æµÄÒ²ÊÇÊý×ÖÀýÈç 001£¬123
aspÀïÃæ strday=100£¬strb=001
ÎÒÏë¶Á³ö£¬´Óa×ֶεÄÊý×Ö°´´óµ½Ð¡µÄË ......
ÏÖÔÚÓÐÁ½¸öÒì¹¹µÄsql serverÊý¾Ý¿â,ÎÒÏ뽫µÚÒ»¸ö±íÖеÄÊý¾Ýµ¼Èëµ½µÚ¶þ¸ö±íÖÐ,×Ô¼ºÖ¸¶¨µ¼ÈëÊý¾ÝµÄ×Ö¶Î,ÈçºÎµ¼ÈëÊý¾ÝÄØ,´ó¼ÒÌÖÂÛÒ»ÏÂ?
dts¹¤¾ß
µ¼Èëµ¼³ö¹¤¾ß.
DD
¹þ¹þ£¬¹À¼ÆÕâλÊǵØQIOU¶¼Êܲ»Á˵Ä
Ö±½ÓÐ ......
StrSQL="Select * from "&DataTable&" Where ID In("& ID &") and Shop_ID="&Shop_ID&Taxis
ÈçºÎ»ñÈ¡ËûµÄ¼Ç¼Êý?
@@ROWCOUNT
Select count(* ......
data a b c d e tag
2009-11-01 11 ......
ÔÚ΢Èí¹Ù·½ÏÂÔØÁËÒ»¸ösqljdbc_2.0Çý¶¯°ü£¬ÏëÓÃsqlserver2008Á¬½Ó¡£µ«×ÜÊÇÔÚÁ¬½ÓÊý¾Ý¿âʱÌáʾ³ö´í£¨ÓÐÒ»µãҪ˵Ã÷µÄÊÇÎҵĵçÄÔÀïÓÐÁ½¸öÊý¾Ý¿â°æ±¾Ò»¸öÊÇsqlserver2005(ĬÈϵÄʵÀý)»¹ÓÐÒ»¸ö¾ÍÊÇsqlserver2008(ÐèÒªÖ¸¶¨Ê ......