°´ÒªÇóͳ¼ÆÏÂÃæÁ½¸ö×Ö¶Î
F_Bh F_Je
1 10
2 20
3 10
5 50
6 10
8 10
9 20
ÒªÇóµÃµ½½á¹ûÈçÏÂ
Bh1 Bh2 Je
1 3 40
5 6 60
8 9 30
F_Bh ±àºÅÁ¬ÐøµÄÔòͳ¼ÆÒ»´Î£¬²¢ÇҼǼÆäʵ±àºÅºÍÖÕÖ¹±àºÅ
ÓÐÒâ˼
²»Ã÷°×
SQL code:
/*
***************************** ......
Ê÷½á¹¹ÈçÏ£º
id employee_id username age Salary higher_id
1 E001 a 32 20000 E001
2 E002 a1 30 12000 E001
3 E003 a2 30 12000 E001
4 E004 aa1 25 4000 E002
5 E005 aa2 25 4000 E002
6 E006 aa3 32 4000 E003
ÈçºÎµÃ³öijԱ¹¤ÏÂÃæËùÓм¶ÁªÔ±¹¤µÄ×ÜÊý ±ÈÈ磺Ա¹¤ a ÏÂÃæÓÐ 2¸ö £¨a1,a ......
select ID,Item1,Item2,Item3
into #Temp
from (
select ID='200910',Item1='A',Item2='B',Item3='C'
union all
select ID='200910',Item1='',Item2='B',Item3='C'
union all
select ID='200910',Item1='A',I ......
id name groupId date levelid
1 a 1 2008 1
2 b 1 2009 1
3 c 2 2007 2
4 d 3 2006 3
5 e ......
ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Äê¸ø 2 ת³ö 1 ±Ê 500Ôª
2009 1 3 1 100 Ϊ 1 µ¥Î» ÔÚ2009Ä ......
create table tb(tid varchar(6),rq datetime,rk int,cl int)
Insert into tb
Select 1,'2009-8-11',100,20 union all
Select 1,'2009-10-11',0,50 union all
Select 1,'2009-11-11',10,60
ÏëµÄµ½µÄ½á¹ûÊÇ£º
rq tid ÆÚ³õÊýÁ¿ rl ......