sqlÓï¾äÎÊÌâ - Oracle / »ù´¡ºÍ¹ÜÀí
id a b
-----------
1 2 12
1 1 100
1 2 123
1 1 130
1 2 153
1 1 171
1 1 188
1 2 200
1 2 222
1 1 234
1 2 333
1 2 344
1 2 411
ÔʼÊý¾Ý°´ÕÕbÁÐÅÅÐò£¬Õý³£Êý¾ÝaÁÐÊÇ1£¬2½»Ì棬Ȼºó·Ö±ðÈ¡µÃbÁеÄÖµ
Èç¹ûaÁпªÊ¼Êý¾ÝÊÇ2£¬ÉáÈ¥2¶ÔÓ¦µÄbÁеÄÖµ
Èç¹ûaÁгöÏÖÏàͬµÄ1£¬b2ȡϸö1¶ÔÓ¦µÄbÁеÄÖµ
Èç¹ûaÁгöÏÖÏàͬµÄ2£¬Éáȥϸö2¶ÔÓ¦µÄbÁеÄÖµ
ÏëÊä³öµÄ½á¹û
id b1 b2
-----------------
1 100 123
1 130 153
1 171 188
1 188 200
1 234 333
Çë¸÷λ¸ßÊÖ°ï°ï棬дÌõsql£¬ÏÈллÁË
sql¹À¼Æ¹»ÇºÁË
²»Ì«Ã÷°×
ÔʼÊý¾Ý°´ÕÕbÁÐÅÅÐò£¬Õý³£Êý¾ÝaÁÐÊÇ1£¬2½»Ì棬Ȼºó·Ö±ðÈ¡µÃbÁеÄÖµ
Èç¹ûaÁпªÊ¼Êý¾ÝÊÇ2£¬ÉáÈ¥2¶ÔÓ¦µÄbÁеÄÖµ
Èç¹ûaÁгöÏÖÏàͬµÄ1£¬b2ȡϸö1¶ÔÓ¦µÄbÁеÄÖµ
Èç¹ûaÁгöÏÖÏàͬµÄ2£¬Éáȥϸö2¶ÔÓ¦µÄbÁеÄÖµ
ÉÏÃæÊÇÔʼÊý¾Ý±í£¬ÏÂÃæÊÇÏëÒªµÃµ½µÄ½á¹û£¬Äã½áºÏÊý¾Ý¿´Ò»Ï¾ÍÃ÷°×ÁË
SQL code:
create table test1(id number(18,0), a number(18,0), b number(18,0));
insert into test1(id, a, b) values(1,2,12);
insert into test1(id, a, b) values(1,1,100);
insert into test1(id, a, b) values(1,2,123);
insert into test1(id, a, b) values(1,1,130);
insert into test1(id, a, b) values(1,2,153);
insert into test1(id, a, b) valu
Ïà¹ØÎÊ´ð£º
tab1 ×Ö¶Î:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 ×Ö¶Î:goodsid,goodskind£¨ÉÌÆ·ÀàÐÍ£©
tab3 ×Ö¶Î:goodskind£¨ÉÌÆ·ÀàÐÍ£©,kindname
½á¹û£º
µÃµ½ÉÌÆ·ÀàÐÍÔÚÒ»¶Îʱ¼ä ......
½«Ò»¸ö²éѯÓï¾ä¸³¸øÒ»¸ö±äÁ¿£¬ÈçÏ£º
DECLARE @STR NVARCHAR(MAX)
SET @STR='SELECT * from SALE_PROD'
ÔõôÑù²ÅÄÜÖ´ÐÐËüÄØ£¿
Çë¸ßÊÖ£¬ÈÊÐÖ£¬ÏÀ½ã°ï°ïæ°¡
¶àл£¬¿ÉÒÔÀ²£¬¸ßÊÖ°¡
Ö±½ÓÖ´ÐоÍÐÐÁË
exec ......
ͨ¹ýNAME×Ö¶ÎÌõ¼þ²éѯһ¸öÊý¾Ý±í£¬¼ÙÉèÎÒÓÐ100¸öÐÕÃû£¬ÓÐÒÔÏÂÁ½¸ö·½·¨£¬
·½·¨1£º
°Ñ100¸öName ×é³ÉÒ»¸öSQLÓï¾ä£¬±ÈÈç Select * from tmp_table where Name='ÕÅÈý' or Name ='ÀîËÄ' Or ...Or Name='µÚÒ»°Ù¸öÐÕÃû'
......
¸÷λºÃ£¬ÎÒ¸Õ°ÑÒ»¸öASPÍøÕ¾ÉèÖúÃÁË£¬Ò²ÄÜÕý³£·ÃÎÊ¡£µ«ÊÇÔÚÎÒ±¾»úÉϲ»ÄÜ´ò¿ªadmin\login.asp,ËùÒÔÎÞ·¨ÊµÏÖºǫ́¹ÜÀí¡££¨´íÎóÌáʾÎÞ·¨ÕÒµ½ÍøÒ³£¬´úÂë404£¬ÎҵIJÙ×÷ϵͳÊÇwin2000 server)
µ«ÊÇÆæ¹ÖµÄÊÇÔÚ¾ÖÓòÍøµÄÆäËû» ......
ÏÖÔÚ ÎÒÓÐ Êý¾Ý¿â oracle_A £¬ÀïÃæÓÐÕűí Ϊ table_A, È»ºóÎÒÒª¶¨Ê±µÄ °Ñ ÁíÒ»¸öÊý¾Ý¿â oracle_B,ÀïÃæµÄÒ»Õűí table_BµÄÊý¾Ý£¬ÐÂÔö·ÅÈëtable_AÀȻºóÔÙÇå¿Õtable_B£¬ÇëÎÊÓ¦¸ÃÔõô×ö£¿
ÓÃд¸ö´æ´¢¹ý³Ì£¬È»ºóÓ ......