CREATE OR REPLACE VIEW vw_news
AS
SELECT a.*, ROUND(SYSDATE - TO_DATE(upddate, 'YYYY-MM-DD HH24:MI:SS')) datesexp, b.uname, NVL(项目名, '-') projectname FROM
(t_news a
INNER JOIN t_user b ON a.userid = b.id)
LEFT OUTER JOIN t_project c ON a.projectid = c.项目编号
WHERE a.id <> 0
-- ORDER BY a.isbig ASC, a.isrcmd ASC, a.ord ASC, a.id DESC
;
------解决方案-------------------- 相当于
SELECT a.*, ROUND(SYSDATE - TO_DATE(upddate, 'YYYY-MM-DD HH24:MI:SS')) datesexp, b.uname, NVL(项目名, '-') projectname FROM
t_news a ,t_user b ,t_project c
WHERE a.id <> 0
and a.userid = b.id
and a.projectid = c.项目编号(+);
加上d表
SELECT a.*, ROUND(SYSDATE - TO_DATE(upddate, 'YYYY-MM-DD HH24:MI:SS')) datesexp, b.uname, NVL(项目名, '-') projectname FROM
t_news a ,t_user b ,t_project c, T_PRJNODETASKS d
WHERE a.id <> 0
and a.userid = b.id
and a.projectid = c.项目编号(+)
--你没给d表的字段啊
and a.projectid = d.项目编号(+); ------解决方案-------------------- SELECT a.*,
ROUND(SYSDATE - TO_DATE(upddate, 'YYYY-MM-DD HH24:MI:SS')) datesexp,
b.uname, NVL(项目名, '-') projectname FROM
t_news a
INNER JOIN t_user b ON a.userid = b.id)
LEFT OUTER JOIN t_project c ON a.projectid = c.项目编号
WHERE a.id <> 0
SELECT a.*,
ROUND(SYSDATE - TO_DATE(upddate, 'YYYY-MM-DD HH24:MI:SS')) datesexp,
b.uname,
NVL(项目名, '-') projectname,
d.计划完成时间,
d.实际完成时间,
d.任务描述
FROM (t_news a INNER JOIN t_user b ON a.userid = b.id)
LEFT OUTER JOIN t_project c ON a.projectid = c.项目编号
LEFT OUTER JOIN T_PRJNODETASKS ON a.projectid = d.项目编号
WHERE a.id <> 0