我正在尝试从3个不同的表格中选择特定的单元格。
我有3个不同的查询,但是每当我运行它们时,它就会崩溃一段时间,我想知道是否可以将它们组合成一个查询。
SELECT * FROM INFM_DALI_BBM_CSC2.MARA_BBM
WHERE MANDT = '011'
AND MTART IN ('HALB','FERT')
AND "/RB04/YERZKENNZ" in ('EZ','BG','TS')
AND LOGSYS in ('SAPP72011', 'SAPPOE011');
SELECT * FROM INFM_DALI_BBM_CSC2.MARC_BBM
WHERE MANDT = '011'
AND BESKZ IN ('E','F')
AND WERKS in ('8640','864W','E499')
AND LOGSYS in ('SAPP72011', 'SAPPOE011');
SELECT * FROM INFM_DALI_BBM_CSC2.MBEW_BBM
WHERE MANDT = '011'
AND BKLAS IN ('7900','7920')
AND LOGSYS in ('SAPP72011', 'SAPPOE011');
该表应获取该表上的值。 https://drive.google.com/file/d/1TSFJbpBsPJ5ZG61ULX6WumdNt1DUPJXO/view?usp=sharing
答案 0 :(得分:0)
考虑一下:
SELECT * FROM INFM_DALI_BBM_CSC2.MARA_BBM
WHERE MANDT = '011'
AND LOGSYS IN ('SAPP72011', 'SAPPOE011')
AND ( ( MTART IN ('HALB','FERT') AND "/RB04/YERZKENNZ" IN ('EZ','BG','TS') ) OR
( BESKZ IN ('E','F') AND WERKS IN ('8640','864W','E499') ) OR
( BKLAS IN ('7900','7920') ) )