select n.user_name, n.user_passwd, n.user_project, n.start_date, n.end_date from ( select t.name as user_name, t.passwd as user_passwd, cast(from_unixtime(t.from_time, "yyyyMMdd") as int) as start_date, cast(from_unixtime(t.to_time, "yyyyMMdd") as int) as end_date from tableA as t where t.user_id = 1 union all select p.project as user_project from tableB as p where p.project_id = 10 ) as n;
2条答案
按热度按时间pxiryf3j1#
输入SQL是什么?
ecr0jaav2#
select n.user_name,
n.user_passwd,
n.user_project,
n.start_date,
n.end_date
from (
select t.name as user_name,
t.passwd as user_passwd,
cast(from_unixtime(t.from_time, "yyyyMMdd") as int) as start_date,
cast(from_unixtime(t.to_time, "yyyyMMdd") as int) as end_date
from tableA as t
where t.user_id = 1
union all
select p.project as user_project
from tableB as p
where p.project_id = 10
) as n;