新手求解,如图:请问我这样取数有没有问题啊?
要怎么样把这个数据取出来,要不要合并到一个内表里面,怎么操作? 拜托各位解答一下,谢谢!
SELECT KONA~KNUMA vbrk~kunrg kna1~kunnr kna1~name1 kna1~stras kna1~ort01
FROM vbrk INNER JOIN kna1 ON vbrk~kunrg = kna1~kunnr
inner join kona on kona~ernam = vbrk~ernam
INTO CORRESPONDING FIELDS OF TABLE i_tab.
SELECT kona~bonem kona~boart kona~knuma kona~botext kona~vkorg kona~vtweg kona~spart kona~bosta kona~datab kona~datbi
kote003~kunnr konh~knuma_bo konh~knumh konp~bosta konp~kbrue konw~klfn1 konw~kstbw konw~kbetr
FROM kona INNER JOIN kote003 ON kote003~knuma = kona~knuma
INNER JOIN konh ON konh~knuma_bo = kona~knuma
LEFT JOIN konp ON konp~knumh = konh~knumh
LEFT JOIN konw ON konh~knumh = konw~knumh
INTO CORRESPONDING FIELDS OF TABLE t_tab.
SELECT kote003~kunnr s060~knumh s060~spmon s060~kawrt_k s060~kstbs s060~konws s060~ruwrt_k s060~kwaeh konh~knumh vbox~vbeln vbox~vakey vbrp~matnr
vbrp~arktx
FROM kote003 INNER JOIN s060 ON kote003~knumh = s060~knumh
INNER JOIN konh ON konh~knumh = kote003~knumh
INNER JOIN vbox ON vbox~vakey = konh~vakey
LEFT JOIN vbrp ON vbrp~vbeln = vbox~vbeln
INTO CORRESPONDING FIELDS OF TABLE t_tab2.
SELECT kona~knuma m_vmcfb~vbeln m_vmcfb~knuma m_vmcfb~kunag vbrk~vbeln vbrk~fkdat vbrk~vkorg vbrk~vtweg vbrk~spart
FROM kona INNER JOIN m_vmcfb ON kona~knuma = m_vmcfb~knuma
LEFT JOIN vbrk ON vbrk~vbeln = m_vmcfb~vbeln
INTO CORRESPONDING FIELDS OF TABLE t_tab3.
我是分好几块取数的...
能帮我写下吗?
追答定义一个內表,1个就够了,里面很多字段,包括你之前定义的所有字段。
select **** from vbrk
inner join vbrp on vbrp~vbeln = vbrk~vbeln
inner join kona on kona~ernam = vbrk~ernam
inner join m_vmcfb on kona~knuma = m_vmcfb~knuma
inner join kna1 ON vbrk~kunrg = kna1~kunnr
into 內表
where ****.
select * from kote003 into 內表.
select * from kote003 into 內表.
select * from konh into 內表.
select * from konp into 內表.
select * from konw into 內表.
select * from s060 into 內表.
****
****
****
****
****
****
****
***
endselect.
还有1个问题,你这些左连接的时候,你确定没有问题嘛。
粗看就发现你的第一个sql语句跟最后1个sql语句是有冲突的的。