首頁 >資料庫 >mysql教程 >Oracle连接查询和sql语句中的条件判断

Oracle连接查询和sql语句中的条件判断

WBOY
WBOY原創
2016-06-07 15:13:512017瀏覽

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 SELECT 1 UPLOAD, 0 SHENGJI, MR.BUSI_ID, MASTER.PERSON_ID, MASTER.ACNT_ID, MASTER.ID_NUM, MASTER.NAME, MASTER.SEX, MR.MIGRT_OUT_REGION, MR.OUT_OPERA_TIME, MR.OUT_OPERA_ID, MR.IN_OPERA_T

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入

  SELECT 1 UPLOAD,

  0 SHENGJI,

  MR.BUSI_ID,

  MASTER.PERSON_ID,

  MASTER.ACNT_ID,

  MASTER.ID_NUM,

  MASTER.NAME,

  MASTER.SEX,

  MR.MIGRT_OUT_REGION,

  MR.OUT_OPERA_TIME,

  MR.OUT_OPERA_ID,

  MR.IN_OPERA_TIME,

  MR.MIGRATE_STATE,

  MR.MIGRT_IN_REGION,

  case

  when MR.MIGRT_IN_REGION is null then

  '未选择'

  else

  ARC.REGION_NAME

  end AS MIGRT_IN_REGION_NAME

  FROM ADPM_MIGRATE_CPA MASTER, ADPM_MIGRATE_INFO MR

  left join ADPM_REGION_CODE ARC on MR.MIGRT_IN_REGION = ARC.REGION_CODE

  WHERE MASTER.PERSON_ID = MR.PERSON_ID

  AND (MR.MIGRATE_STATE = '10' OR MR.MIGRATE_STATE = '20' OR

  MR.MIGRATE_STATE = '60');

  SELECT 1 UPLOAD,

  0 SHENGJI,

  MR.BUSI_ID,

  MASTER.PERSON_ID,

  MASTER.ACNT_ID,

  MASTER.ID_NUM,

  MASTER.NAME,

  MASTER.SEX,

  MR.MIGRT_OUT_REGION,

  MR.OUT_OPERA_TIME,

  MR.OUT_OPERA_ID,

  MR.IN_OPERA_TIME,

  MR.MIGRATE_STATE,

  MR.MIGRT_IN_REGION,

  case

  when MR.MIGRT_IN_REGION is null then

  '未选择'

  else

  ARC.REGION_NAME

  end AS MIGRT_IN_REGION_NAME

  FROM ADPM_MIGRATE_CPA MASTER, ADPM_MIGRATE_INFO MR, ADPM_REGION_CODE ARC

  WHERE MASTER.PERSON_ID = MR.PERSON_ID

  AND (MR.MIGRATE_STATE = '10' OR MR.MIGRATE_STATE = '20' OR

  MR.MIGRATE_STATE = '60')

  AND MR.MIGRT_IN_REGION = ARC.REGION_CODE(+);

Oracle连接查询和sql语句中的条件判断

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn