Home  >  Article  >  Database  >  Oracle连接查询和sql语句中的条件判断

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

WBOY
WBOYOriginal
2016-06-07 15:13:511986browse

欢迎进入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语句中的条件判断

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn