加入四张或更多张桌子

时间:2016-06-14 11:05:39

标签: sql database oracle

我正在尝试加入5个表,并且我编写了一个类似的查询,但是当我运行此查询时,我收到了无效的Identifier mvk。

SELECT *
  FROM CBH.MARKETINGCBH mcbh
  JOIN CBH.MCBH_INTERESSES mi on mi.MARKETINGCBHID = mcbh.MARKETINGCBHID
  JOIN CBH.INTERESSES i on i.INTERESSESID = mi.INTERESSESID
  JOIN CBH.MAILING_VIA_KANAAL mvk on mvk.MAILINGVIAKANAALID = i.MAILINGVIAKANAALID
  JOIN CBH.RESPONS_INTERESSES ri on  ri.INTERESSESID=mvk.INTERESSESID 
 WHERE mcbh.CBHID = '10351720'
   AND mvk.MAILINGKANAALCODE = 'EMA'
   AND i.SOORTINTERESSECODE = 'INT'
   AND mi.DATUM > (SELECT mi2.DATUM 
                     FROM CBH.MARKETINGCBH mcbh2
                     JOIN CBH.MCBH_INTERESSES mi2 on mi2.MARKETINGCBHID = mcbh2.MARKETINGCBHID
                     JOIN CBH.INTERESSES i2 on i2.INTERESSESID = mi2.INTERESSESID
                    WHERE i2.SOORTINTERESSECODE = 'DES'
                      AND mcbh2.CBHID = '10351720' 
                      AND i2.MAILINGVIAKANAALID = i.MAILINGVIAKANAALID);

1 个答案:

答案 0 :(得分:0)

您的代码是否从任何地方复制并粘贴?我建议更换" mvk"在整个查询过程中用全新的东西作为测试。我已经看到了被抛出的隐形字符。请确保删除别名周围的所有空格。