使用ON <column> = <constant>加入&#34;不支持JOIN表达式&#34;错误

时间:2016-04-18 11:58:11

标签: sql ms-access join

有人可以告诉我我的代码有什么问题吗?

String sqlQuery = @"SELECT la.id, ac.id
 FROM lablesM as la LEFT JOIN
 actions as ac
ON ac.id = 4;";

这是错误:

JOIN expression not supported.

非常感谢!

2 个答案:

答案 0 :(得分:0)

做这样的事情:

"SELECT la.id, ac.id
 FROM lablesM la 
 LEFT JOIN actions ac
 ON ac.id = la.id 
 AND ac.id = 4;"

答案 1 :(得分:0)

我认为您应该将SQL语句重写为

String sqlQuery = @"SELECT la.id, ac.id
 FROM lablesM as la inner JOIN
 actions as ac
ON (ac.id = la.id)
where ac.id = 4;";

我认为la.id是外键字段。