Çó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
Ïà¹ØÎÊ´ð£º
with adod_dict do
begin
close;
commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......
ÓÐÁ½Õűí T1, T2
T1:
id, name, T2id £¬discription
T2:
id, subName
ÆäÖÐ T1µÄ T2id ÓëT2µÄ id ¶ÔÓ¦
ÏëÒÔT1µÄ name ºÍ T2µÄ subName Ϊ Ìõ¼þ ²éѰT1µÄ discripton.
Çë¸ßÊÖÖ¸µ ......
дSQLÓï¾ä£º
±í1£ºCLASS
º¬ÓÐÁ½¸ö×ֶΣºID£¬CLASSNAME,±í½á¹¹ÈçÏ£º
ID CLASSNAME
1 A
2 B
3 C
4 D
±í2£ºSTUDENT
º¬ÓÐÈçÏÂ×ֶΣºS ......
ÎÒϵͳʽwin7 £¬Êý¾Ý¿âsqlserver2008.Ò»Ö±ÓÃwindowsÑéÖ¤£¬µÇ½£¬²»ÄÜÓÃsqlÑéÖ¤£¬ÔÚsaÉÏÖØÐÂ×¢²áÒ»¸öÓû§µÄ»°£¬µÇ½ʱµÚÒ»±é±¨
Òѳɹ¦Óë·þÎñÆ÷½¨Á¢Á¬½Ó£¬µ«ÊÇÔڵǼ¹ý³ÌÖз¢Éú´íÈ¡¡££¨provider:¹²ÏíÄÚ´æÌṩ³ÌÐò£¬ ......
Á½ÖÖ´íÎó£º
1.Èç¹ûÎÒÕâÑùÉêÃ÷£ºResultSet rs;´íÎóÌáʾÈçÏ£º
An error occurred at line: 51 in the jsp file: /index.jsp
The local variable rs may not have been initialized
48: ......