Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sql²éѯÎÊÌâ

http://wenda.tianya.cn/wenda/thread?tid=008e40988f9b74c0
ÎÒµÄÎÊÌâдÔÚÕâÀïÁ˰ÝÍдó¼Ò¿´¿´£¬ÉÏÎçcsndÉý¼¶²»ÄÜÓþÍÔÚÌìÑÄÉÏдÁË¡£
ÕâÀïÃæÐ´ÁË·¢±í²»ÁË×Ü˵ÓзǷ¨´Ê»ò´Ê×éºÜÓôÃÆ£¬Ð»Ð»´ó¼Ò 
FULL JOIN

°ÑÊý¾ÝÌù³öÀ´




SELECT ISNULL(A.feename,B.feename)feename,ISNULL(A.money,0)-ISNULL(B.money,0) AS money from
@TB1 A FULL JOIN @TB2 B ON A.feename=B.feename




¾¹È»·¢²»Á˱í½á¹¹,ÔÎ

ÒýÓÃ
http://wenda.tianya.cn/wenda/thread?tid=008e40988f9b74c0
ÎÒµÄÎÊÌâдÔÚÕâÀïÁ˰ÝÍдó¼Ò¿´¿´£¬ÉÏÎçcsndÉý¼¶²»ÄÜÓþÍÔÚÌìÑÄÉÏдÁË¡£
ÕâÀïÃæÐ´ÁË·¢±í²»ÁË×Ü˵ÓзǷ¨´Ê»ò´Ê×éºÜÓôÃÆ£¬Ð»Ð»´ó¼Ò 

ºÍÄãÒ»ÑùŶ,ÔÎ

SQL code:
if object_id('[Ó¦ÊÕ·ÑÓÃ]') is not null drop table [Ó¦ÊÕ·ÑÓÃ]
go
create table [Ó¦ÊÕ·ÑÓÃ]([feename] varchar(8),[money] numeric(5,2))
insert [Ó¦ÊÕ·ÑÓÃ]
select '¹ÜÀí·Ñ',20.00 union all
select 'ËÙµÝÔË·Ñ',600.00 union all
select 'ͨÐÅ·Ñ',450.00
if object_id('[Ó¦¸¶·ÑÓÃ]') is not null drop table [Ó¦¸¶·ÑÓÃ]
go
create table [Ó¦¸¶·ÑÓÃ]([feename] varchar(8),[money] numeric(5,2))
insert [Ó¦¸¶·ÑÓÃ]
select '°ì Ö¤·Ñ',638.79 union all
select '¸½¼Ó·ÑÓÃ',107.25 union all
select 'ËÙµÝÔË·Ñ',555.00

SELECT
ISNULL(A.feename,B.feename) AS feename,
ISNULL(A.[money],0)-ISNULL(B.[money],0) AS [money]
from


Ïà¹ØÎÊ´ð£º

ÇóSQL£¿

´ó¼ÒºÃ£¬ÇëÎÊÔÚ±íMÖÐÓÐ×ֶΣºa b c d e 
ÎÒÏë²é³öÆäÖÐÂú×ãÏÂÃæÈÎÒâÒ»ÏîµÄÊý¾Ý£¬1.×Ö¶Îa µÄÖµ²»ÊÇ ¡®Êé»ò±Ê»ò±¾¡¯ÖÐÈÎÒ»£¬2.aΪÊéµÄʱºò×Ö¶Îb,cÊÇ¿Õ;3.µ±aֵΪ±ÊµÄʱºòdÊÇ¿Õ;4.µ±aΪ±¾µÄʱºòb,d,e¶¼ÊÇ¿Õ;5.È ......

¹ØÓÚgroup byµÄsqlÓï¾ä£¿

  with adod_dict do
    begin
    close;
    commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......

¾Ý˵SQLÓиö±à¼­Æ÷£¬²»ÖªÈçºÎʹÓ÷¨£¬ÔÚʲôµØ·½£¿

ÒªÊäÈëUSE <Êý¾Ý¿âÃû>ʱ£¬ÒªÓõ½SQL±à¼­Æ÷£¬µ«²»ÖªµÀÔÚʲôµØ·½£¬¸ßÊÖ°ï°ïæѽ£¡

SQL2005  µã»÷ÓÒÉϽǵÄ--н¨²éѯ(N)

Êó標選擇Òª²é詢µÄ數據庫£¬È»á ......

sql ±¯¾ç

http://topic.csdn.net/u/20091008/12/a2577eba-1b5b-4e1e-ab20-0a047bf3f8d7.html?4385
1Â¥
liangCK
SQL code:
update a set
ʱ¼ä = b.ʱ¼ä
from tb1 as a
join tb2 as b
on a.¿¨ºÅ= b.¿¨ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ