将左连接与逗号

时间:2018-05-09 10:38:54

标签: mysql sql join

所以我有这个SQL代码:

SELECT * 
FROM A a1, AP ap1, P p1, M m1 
LEFT JOIN F f1 ON f1.id_f = p1.f1
LEFT JOIN C c1 ON p1.c_id = c1.c_id
LEFT JOIN S s1 on p1.saison_id = s1.s_id
WHERE a1.a_type NOT IN (1) 
AND a1.type_c IN (1,2) 
AND ap1.a_id = a1.achats_id
AND p1.p_id = ap1.products_id
AND p1.m_id = m1.m_id
ORDER BY a_id ASC

我收到了这个错误:

#1054 - Unknown column 'p1.f1' in 'on clause' 

所以我不知道为什么它不识别第3行的p1.f1。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

您只需使用正确的INNER JOINSELECT * FROM A a1 JOIN AP ap1 ON ap1.a_id = a1.achats_id JOIN P p1 ON p1.p_id = ap1.products_id JOIN M m1 ON p1.m_id = m1.m_id LEFT JOIN F f1 ON f1.id_f = p1.f1 LEFT JOIN C c1 ON p1.c_id = c1.c_id LEFT JOIN S s1 ON p1.saison_id = s1.s_id WHERE a1.a_type NOT IN (1) AND a1.type_c IN (1, 2) ORDER BY a1.a_id ASC; 语法:

import Alert from './source1'

( ($) => {
    const version = $.fn.jquery.split( ' ' )[ 0 ].split( '.' )
} )( $ )

export {
    Alert,
}

瞧!问题解决了。