欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

oracle数据库 多张表记录连接union

程序员文章站 2024-01-22 10:05:52
...

CREATE OR REPLACE VIEW UIA.VIEW_UIA_USER AS ( SELECT t1.ID,t1. USER_NAME ,t1.USER_PASS,t1.USER_IDCARD,t1.USER_ALIAS,t1.USER_EMAIL,t1.USER_STUDENTID,t1.USER_WORKERID,t1.USER_TYPE,t1.USER_PHONENUMBER,t1.USER_STATUS, uia_user fromtab FROM uia

CREATE OR REPLACE VIEW UIA.VIEW_UIA_USER AS
(SELECT t1."ID",t1."USER_NAME",t1."USER_PASS",t1."USER_IDCARD",t1."USER_ALIAS",t1."USER_EMAIL",t1."USER_STUDENTID",t1."USER_WORKERID",t1."USER_TYPE",t1."USER_PHONENUMBER",t1."USER_STATUS",'uia_user' fromtab FROM uia.uia_user t1
UNION
SELECT t2."ID",t2."USER_NAME",t2."USER_PASS",t2."USER_IDCARD",t2."USER_ALIAS",t2."USER_EMAIL",t2."USER_STUDENTID",t2."USER_WORKERID",t2."USER_TYPE",t2."USER_PHONENUMBER",t2."USER_STATUS",'uia_user_TEMP' fromtab FROM uia.uia_user_temp t2);

fromtab 字段是静态值

UNION 连接