ÇóSQLÓï¾äµÄд·¨
ÎÒÏÖÔÚÓÐ2¸ö±íTable1£¬Table2¡£¶ÔÓ¦µÄ×ֶΡ¢Êý¾ÝÈçÏ£º
Table1£ºprimary key(a1)
a1(char) a2(int)
a 10
b 30
Table2£ºprimary key(b1)
b1(char) b3(int)
a 5
c 40
d 100
----------------------------------------------------------------------------------
ÎÒÏëҪʵÏÖµÄÊÇ£º¸ù¾ÝTable1µÄa1×ֶΣ¬µÃµ½a2»òÕßb2µÄÊý¾Ý¡£
Ò²¾ÍÊÇ˵£¬Èç¹ûTable2ÀïÃæb1×ֶκÍTable1ÀïµÄa1×Ö¶ÎÏàͬµÄ£¬ÄÇô¾ÍÓÃb2µÄÊý¾Ý¡£
ÀýÈ磺¸ù¾ÝÒÔÉϵÄÊý¾Ý£¬ÎÒÒªµÃµ½µÄÊÇ£º
a 5
b 30
----------------------------------------------------------------------------------
ÇëÎÊÕâ¸öSQLÓï¾äÓ¦¸ÃÔõôд£¿
¶Ô²»Æð£¬ÉÏÃæµÄTable2µÄ±í½á¹¹Ð´´íÁË£¬ÐÞ¸ÄÏÂ
Table2£ºprimary key(b1)
b1(char) b2(int)
a 5
c 40
d 100
--> ²âÊÔÊý¾Ý£º[Table1]
if object_id('[Table1]') is not null drop table [Table1]
c
Ïà¹ØÎÊ´ð£º
ÏÖÔÚÓÐÁ½¸öÒì¹¹µÄsql serverÊý¾Ý¿â,ÎÒÏ뽫µÚÒ»¸ö±íÖеÄÊý¾Ýµ¼Èëµ½µÚ¶þ¸ö±íÖÐ,×Ô¼ºÖ¸¶¨µ¼ÈëÊý¾ÝµÄ×Ö¶Î,ÈçºÎµ¼ÈëÊý¾ÝÄØ,´ó¼ÒÌÖÂÛÒ»ÏÂ?
dts¹¤¾ß
µ¼Èëµ¼³ö¹¤¾ß.
DD
¹þ¹þ£¬¹À¼ÆÕâλÊǵØQIOU¶¼Êܲ»Á˵Ä
Ö±½ÓÐ ......
with adod_dict do
begin
close;
commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......
id name sfz
1 aa 410654198001204562
2 bb 410654198120461287
4 cc 41065419850 ......
BeginTime BtsId Total68PhyRCENum
2009-9-30 0:00 1 192
2009-10-1 0:00 1 192
2009-10-2 0:00 1 192
2009-10-3 0:00 1 192
2009-10-4 0:00 1 256
2009-10-5 0:00 1 256
2009-10-6 0:0 ......