Access µÄ SQL µÄ¼Ç¼¼äµÄ¼Ó¼õ¼ÆËã
Access µÄ SQL ÖУ¬¼ÆËãÏàÓ¦±àºÅµÄ¼Ç¼֮¼ä ¼Ó ¼õ µÄ²éѯÃüÁî
ÀýÈç ¼ÆËãIDΪ 6 µÄ ºÏ¼Æ ¼õÈ¥ ID Ϊ 2¡¢3¡¢4 ÒÔ¼°¼ÓÉÏ ID Ϊ 5 µÄºÏ¼Æ
SELECT SUM(R) AS ½á¹û
from
(
SELECT ºÏ¼Æ AS R from T1 WHERE (ID = 6) UNION
SELECT -ºÏ¼Æ AS R from T1 WHERE (ID = 2) UNION
SELECT -ºÏ¼Æ AS R from T1 WHERE (ID = 3) UNION
SELECT -ºÏ¼Æ AS R from T1 WHERE (ID = 4) UNION
SELECT ºÏ¼Æ AS R from T1 WHERE (ID = 5)
) T
Ïà¹ØÎĵµ£º
¡¾SQL¡¿ÐÐÁÐת»»
http://space.itpub.net/519536/viewspace-609167
Ò»¡¢ÁбäÐÐ
1.´´½¨²âÊÔ±ítest£¬²¢³õʼ»¯ÊµÑéÊý¾Ý
sec@ora10g> create table test (name_id varchar2(10), name varchar2(10));
sec@ora10g> insert into test values ('01','Andy1');
sec@ora10g> insert into test values ('01','Andy2'); ......
ºÜÉÙÓÃjoin£¬Õâ´Îѧѧ£¬²¢±¸ÍüÁ½ÆªÎÄÕ£¡
ת×Ô£ºhttp://hcx-2008.javaeye.com/blog/285661
Á¬½Ó²éѯ
ͨ¹ýÁ¬½ÓÔËËã·û¿ÉÒÔʵÏÖ¶à¸ö±í²éѯ¡£Á¬½ÓÊǹØϵÊý¾Ý¿âÄ£Ð͵ÄÖ÷ÒªÌص㣬ҲÊÇËüÇø±ðÓÚÆäËüÀàÐÍÊý¾Ý¿â¹ÜÀíϵͳµÄÒ»¸ö±êÖ¾¡£
ÔÚ¹ØϵÊý¾Ý¿â¹ÜÀíϵͳÖУ¬±í½¨Á¢Ê±¸÷Êý¾ÝÖ®¼äµÄ¹Øϵ²»±ØÈ·¶¨£¬³£°ÑÒ»¸öʵÌåµÄËùÓÐÐÅÏ¢´æ·ÅÔÚÒ ......
--¸Ã±í±£´æ½á¹û
create table c(c1 tinyint, c2 tinyint, c3 tinyint, c4 tinyint, c5 tinyint, c6 tinyint, c7 tinyint, c8 tinyint, c9 tinyint, c10 tinyint, c11 tinyint, c12 tinyint, c13 tinyint, c14 tinyint, c15 tinyint, c16 tinyint, c17 tinyint, c18 tinyint, c19 tinyint, c20 tinyint, c21 tinyint, c22 t ......
dim conn,connstr
Set conn = Server.CreateObject("ADODB.Connection")'´´½¨Ò»¸öÊý¾Ý¿âÁ´½Ó¶ÔÏóconn£¬·½±ãºóÃæµ÷ÓÃ
connstr="Provider=SQLOLEDB;Data Source=(local);Initial Catalog=111;User ID=sa;Password=1234;" '´´½¨Ò»¸öÊý¾Ý¿âµÄrecordset¶ÔÏ󣬷½±ãÒÔºóµ÷ÓÃ
conn.Open connstr'´ò¿ªÊý¾Ý¿â ......