左连接出错

select Evidence_ID,
         VIO_TIME,
         ADDRESS_CODE,
         ADDRESS_DESC,
         VIO_BEHAVIORS_DESC,
         DEVICE_NBR,
         DEVICE_TYPE,
         DIRECTION,
         SPEED,
         LIMIT_SPEED_VEHICLE_SMALL,
         LIMIT_SPEED_VEHICLE_BIG,
         GATHER_ORG_NAME,
         d.user_name,
         PLATE_NBR,
         c.code_name               as plate_type_name,
         DRIVEMODE,
         VEHICLE_COLOR,
         VEHICLE_ISSUE_ORG,
         VEHICLE_ENGINE_ID,
         VEHICLE_OWNER_NAME,
         VEHCILE_OWNER_DIVISION,
         VEHCILE_OWNER_ADDRESS,
         VEHICLE_OWNER_PHONE,
         Update_Time,
         b.code_name               as evidencetype
    from other_vio_evidence a, t_code b, t_code c
    LEFT JOIN T_user d
      ON other_vio_evidence.gather_police = t_user.User_id
   where a.evidence_type = trim(b.code_no)
     and b.code_type = '204'
     and a.plate_type = trim(c.code_no)
     and c.code_type = '20'
     and Evidence_ID = :evidenceID

 

 

 

 

改正后:

select Evidence_ID,
       VIO_TIME,
       ADDRESS_CODE,
       ADDRESS_DESC,
       VIO_BEHAVIORS_DESC,
       DEVICE_NBR,
       DEVICE_TYPE,
       DIRECTION,
       SPEED,
       LIMIT_SPEED_VEHICLE_SMALL,
       LIMIT_SPEED_VEHICLE_BIG,
       GATHER_ORG_NAME,
       d.user_name,
       PLATE_NBR,
       c.code_name               as plate_type_name,
       DRIVEMODE,
       VEHICLE_COLOR,
       VEHICLE_ISSUE_ORG,
       VEHICLE_ENGINE_ID,
       VEHICLE_OWNER_NAME,
       VEHCILE_OWNER_DIVISION,
       VEHCILE_OWNER_ADDRESS,
       VEHICLE_OWNER_PHONE,
       Update_Time,
       b.code_name               as evidencetype
  from  t_code b, t_code c,other_vio_evidence a
  LEFT JOIN T_user d
    ON a.gather_police = d.User_Id
 where a.evidence_type = trim(b.code_no)
   and b.code_type = '204'
   and a.plate_type = trim(c.code_no)
   and c.code_type = '20'  select T_user.User_id from t_user

你可能感兴趣的:(左连接)