sql语句,多个表之间,通过相同内容字段的联合查询

时间:2021-09-12 21:36:37

1 , select j.id,
         jt.Name,
        j.ApproveType ,
         j.ProductCode,
         j.CustomerCode,
         u.FullName,
         jf.Name as jfName,
         j.ExpectedTime
   from JudgeOrder as j
  join JudgeOrderType as jt  on j.JudgeType=jt.Id
  join [User] as u on j.SalesManCode=u.Name
  join JudgeOrderFormat as jf on j.FormatType=jf.id order by j.Id

核心就是:tableName1 as tName1 join tableName2 as tName2 on tName1.xxx = tName2.xxx

通俗易懂!