String sql = "select a.id as id,a.title as title,a.sequence as sequence,b.names as departName,c.names as webName from board as a left join department as b on a.depart_id=b.id join web as c on a.web_id=c.id where 1=1";
这句话什么意思,a.id as id 这是什么意思? join有是什么意思?

解决方案 »

  1.   

    as是字段别名
    join是关键词这些自己找书看或者翻联机帮助
      

  2.   

    你好,如果上面的a.depart_id=b.id中的depart_id 无效怎么修改?
      

  3.   

    不明确吧,你好好看看depart_id 是哪个table里面的
      

  4.   

    从:board 表,别名为 a 左连接 department 表,别名 b 它们通过a表的depart_id和b表的id关联。然后得到的结果再和 web 表,别名c表关联。where 1=1恒为true,估计是为了后面拼接字符串所以凑一个where出来。这只是技巧而已。as 是把as前面的字段换成as 后面的字段名,即取别名,join是连接。包括内连接、外联结两种。详细请看联机丛书,join是非常重要的关键字,请理解好。