select A.commandKey,A.enabled,A.commandFile,A.targetControl,A.rightId,A.type,[B].[value] as commandType,A.state,[C].[value] as commandState,A.parent,A.commandText,A.commandTipText,A.icon,A.description 
from t_commands as A 
inner join t_parameters as B on [A].[type]=[B].[code] 
inner join t_parameters as C on [A].[state]=[C].[code] 
where B.id=3 and C.id=4
如上SQL,执行的时候就提示“语法错误(操作符丢失)在‘[A].[type]=[B].[code]  
inner join t_parameters as C on [A].[state]=[C].[code] ’中”的提示,然后我发现如果把后面的join语句去掉不连接的话就能正常查询出数据,是不是Access不支持多个连接查询的?

解决方案 »

  1.   

    select * from (select * from table1 t1 left join table2 t2 on t1.id=t2.id) t left join table3
      t3 on t.id=t3.id 
    只有用LEFT JOIN+RIGHT JOIN
      

  2.   

    select A.commandKey,A.enabled,A.commandFile,A.targetControl,A.rightId,A.type,.[value] as commandType,A.state,[C].[value] as commandState,A.parent,A.commandText,A.commandTipText,A.icon,A.description 
    from (t_commands as A 
    inner join t_parameters as B on [A].[type]=[B].[code] )
    inner join t_parameters as C on [A].[state]=[C].[code] 
    where B.id=3 and C.id=4
    [b]加上()
      

  3.   

    高手都帮你回答了
    我就告诉你一个比较简单、快速的查询语句方法
    你直接使用Access提供的查询功能,先选择表 再选择要查询的字段和条件 
    然后再对SQL语句优化下 就可以用了
    但是如果你想锻炼你写SQL的能力 上面的方法 也可以参考下
      

  4.   

    to ACMAIN_CHM
    我按你的写法去写了,现在没报错了,但是却查询不出数据