MSQL&访问:查询表达式中的语法错误(缺少运算符)

时间:2016-09-06 14:42:12

标签: ms-access inner-join

我有一个查询,我刚从Oracle标记/ SQL转换为MSQL(在Access中)。

我现在遇到的问题是我认为编译的MSQL是正确的。我在网上看到你需要在每个INNER JOIN周围加上括号,因为Access很挑剔,但似乎无法弄明白。

非常感谢任何帮助。

SELECT sed.evt_dt,
sed.evt_data_seq,
ifdd.ifd_seg_data,
ea_data.evt_arg_val,
ea_data2.evt_arg_val,
ea_data3.evt_arg_val,
sml.dwnld_seq,
ifdh.comm_cmnt  
   FROM RPWMSPRD_SL_EVT_DATA as sed
        INNER JOIN RPWMSPRD_SL_MSG_LOG as sml
            ON sml.evt_data_seq = sed.evt_Data_seq
        INNER JOIN RPWMSPRD_SL_EVT_ARG_DATA as ea_data
            ON ea_data.evt_data_seq = sed.evt_data_seq
        INNER JOIN RPWMSPRD_SL_EVT_ARG_DEF as ea_def
            ON (ea_def.evt_id = ea_data.evt_id AND and ea_def.evt_arg_id = ea_data.evt_arg_id)
        INNER JOIN RPWMSPRD_SL_EVT_ARG_DATA as ea_data2
            ON ea_data2.evt_data_seq = sed.evt_data_seq
        INNER JOIN RPWMSPRD_SL_EVT_ARG_DEF as ea_def2
            ON (ea_def2.evt_id = ea_data2.evt_id AND ea_def2.evt_arg_id = ea_data2.evt_arg_id)
        INNER JOIN RPWMSPRD_SL_EVT_ARG_DATA as ea_data3
            ON ea_data3.evt_data_seq = sed.evt_data_seq
        INNER JOIN RPWMSPRD_SL_EVT_ARG_DEF as ea_def3
            ON (ea_def3.evt_id = ea_data3.evt_id AND ea_def3.evt_arg_id = ea_data3.evt_arg_id)
        INNER JOIN RPWMSPRD_SL_IFD_DATA_DTL as ifdd
            ON sml.in_ifd_data_seq = ifdd.ifd_data_seq
        INNER JOIN RPWMSPRD_SL_IFD_DATA_HDR as ifdh
            ON sml.dwnld_seq = ifdh.dwnld_seq
WHERE sed.evt_stat_cd = 'EE'
and sml.msg_log_seq IN (SELECT min(msg_log_seq)
                                           FROM RPWMSPRD_SL_MSG_LOG sml2
                                           WHERE sml2.evt_data_seq = sml.evt_data_seq
                                           AND ifdd.ifd_seg_data LIKE '%X%'
                                           GROUP BY evt_data_seq)
and sed.evt_dt > NOW() – 5
ORDER BY sed.evt_dt DESC;

0 个答案:

没有答案