請教下面這個sql語法在說什麼? |
尚未結案
|
huangeider
高階會員 發表:288 回覆:492 積分:231 註冊:2003-02-26 發送簡訊給我 |
主要是不知道union的作用,是否和and相似呢?
select cust.cus_no,cust.snm,mf_arp.bil_dd,mf_arp.pay_dd,mf_arp.bil_no,
tf_pss.prd_name,mf_arp.amtn,mf_arp.amtn_rcv
from mf_arp,cust,tf_pss where mf_arp.cus_no=cust.cus_no
and cust.cus_no= :cus_no
and cust.cus_no in (select cust_dw from cust_chk where cust_up=:kh3 )
and (mf_arp.bil_no=tf_pss.ps_no )
and tf_pss.itm=1
and mf_arp.ARP_ID = '1' union
select cust.cus_no,cust.snm,mf_arp.bil_dd,mf_arp.pay_dd,mf_arp.bil_no,
mf_arp.rem,mf_arp.amtn,mf_arp.amtn_rcv
from mf_arp,cust
where mf_arp.cus_no=cust.cus_no
and cust.cus_no= :kh1
and (mf_arp.bil_no not in(select ps_no from tf_pss )) and mf_arp.ARP_ID = '1' union
select max(cust.cus_no),max(cust.snm),max(rp_dd),'',rp_no,'本期收款',0,sum(amtn_cls) from tc_mon,cust
where cust.cus_no=tc_mon.cus_no
and cust.cus_no= :kh2
and tc_mon.rp_id=1 group by rp_no 堅持從洗馬桶做起
Eric
|
Chance36
版主 發表:31 回覆:1033 積分:792 註冊:2002-12-31 發送簡訊給我 |
huangeider 你好
請參考以下連結,有些說明應該對你有幫助
http://delphi.ktop.com.tw/topic.php?topic_id=46127
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |