当前位置:网站首页>Oracle is nested at multiple levels, and the alias problem of the table cannot be found
Oracle is nested at multiple levels, and the alias problem of the table cannot be found
2022-07-26 01:21:00 【Windyº】
Here's the thing , In the statistics of a sail soft report , Multi table joint query . One of the fields should not only be associated with the appearance, but also take the first record in reverse chronological order .
This is OK , But in the Lord SQL in Hint not found AP.ID.
SELECT *
FROM (
SELECT t.REPORT_RATING
FROM IAM_REPORT_HEAR_TEMPLATE t
WHERE t.PROJECT_ID = '-1750442436769594485'
ORDER BY t.MODIFY_TIME DESC
)
WHERE ROWNUM = 1;
Below are nested layers , Cannot find a solution to the table alias :
SELECT
AU.UNITNAME AS Work unit ,
SW.USER_NAME AS full name ,
TO_CHAR(FR.PUBLISH_TIME, 'yyyy') AS year ,
TO_CHAR(AP.AUDITSCHEDULE_START, 'YYYY-MM-DD') || ' to ' || TO_CHAR(AP.AUDITSCHEDULE_END, 'YYYY-MM-DD') AS Date of on-site audit ,
AP.PROJECT_NAME AS Participation in the project ,
PS.PROJECT_GRADE AS Project approval level ,
SW.PARTICIPATE_TYPE AS Form of participation ,
PS.PROJECT_TOTAL AS Set value of project integral ,
AP.PREDICTED_WORKDAYS AS Standard man day ,
(SELECT SUM(w.DAYS) FROM IAM_PROJECT_SCORE_WORKLOAD w WHERE w.PROJECT_SCORE_ID = PS.ID AND w.USER_ROLE IN (' Chief judge ', ' Team members ')) AS Actual person day ,
SW.DAYS AS Participation days ,
PS.STANDARD_WORKING_DAY AS Standard daily upper limit ,
-- TRUNC(PS.PROJECT_TOTAL / (SELECT SUM(w.DAYS) FROM IAM_PROJECT_SCORE_WORKLOAD w WHERE w.PROJECT_SCORE_ID = PS.ID AND w.USER_ROLE IN (' Chief judge ', ' Team members ')) * PS.STANDARD_WORKING_DAY, 2) AS Actual integral ,
-- SW.SCORE AS Actual integral ,
TRUNC(PS.PROJECT_TOTAL * SW.DAYS / (SELECT SUM(w.DAYS) FROM IAM_PROJECT_SCORE_WORKLOAD w WHERE w.PROJECT_SCORE_ID = PS.ID AND w.USER_ROLE IN (' Chief judge ', ' Team members ')), 2) AS Actual integral ,
SW.USER_ROLE AS Project role ,
CASE WHEN SW.USER_ROLE = ' group leader ' THEN 1 ELSE SW.DIVISION_COEFFICIENT END AS Grouping division coefficient ,
(SELECT tt.REPORT_RATING FROM (
SELECT t.REPORT_RATING, t.PROJECT_ID, t.MODIFY_TIME
FROM IAM_REPORT_HEAR_TEMPLATE t
ORDER BY t.MODIFY_TIME DESC) tt , IAM_AUDIT_PROJECT app
WHERE tt.PROJECT_ID = app.ID AND ap.id = app.ID AND ROWNUM = 1) AS Project report level ,
(SELECT tt.SJZLXS FROM (
SELECT t.SJZLXS, t.PROJECT_ID, t.MODIFY_TIME
FROM IAM_REPORT_HEAR_TEMPLATE t
ORDER BY t.MODIFY_TIME DESC) tt , IAM_AUDIT_PROJECT app
WHERE tt.PROJECT_ID = app.ID AND ap.id = app.ID AND ROWNUM = 1) AS Audit quality coefficient ,
TRUNC((SELECT SUM(w.SCORE) / COUNT(1) FROM IAM_PROJECT_SCORE_WORKLOAD w WHERE w.PROJECT_SCORE_ID = PS.ID AND w.USER_ROLE IN (' Chief judge ', ' Team members ')), 2) AS Average score of team members ,
-- TRUNC(TRUNC(PS.PROJECT_TOTAL / (SELECT SUM(w.DAYS) FROM IAM_PROJECT_SCORE_WORKLOAD w WHERE w.PROJECT_SCORE_ID = PS.ID AND w.USER_ROLE IN (' Chief judge ', ' Team members ')) * PS.STANDARD_WORKING_DAY, 2) *
-- CASE WHEN SW.USER_ROLE = ' group leader ' THEN 1 ELSE SW.DIVISION_COEFFICIENT END *
-- (SELECT t.sjzlxs FROM IAM_REPORT_HEAR_TEMPLATE t WHERE t.PROJECT_ID = AP.ID AND ROWNUM = 1), 2) AS Project points ,
TRUNC(TRUNC(PS.PROJECT_TOTAL * SW.DAYS / (SELECT SUM(w.DAYS) FROM IAM_PROJECT_SCORE_WORKLOAD w WHERE w.PROJECT_SCORE_ID = PS.ID AND w.USER_ROLE IN (' Chief judge ', ' Team members ')), 2)*
CASE WHEN SW.USER_ROLE = ' group leader ' THEN 1 ELSE SW.DIVISION_COEFFICIENT END *
(SELECT t.sjzlxs FROM IAM_REPORT_HEAR_TEMPLATE t WHERE t.PROJECT_ID = AP.ID AND ROWNUM = 1), 2) AS Project points ,
TO_CHAR(ROUND(nvl(SW.BACK_INTEGRAL, 0), 2), 'fm99999999999990.00') AS Project backtracking ,
TRUNC(TRUNC(PS.PROJECT_TOTAL / (SELECT SUM(w.DAYS) FROM IAM_PROJECT_SCORE_WORKLOAD w WHERE w.PROJECT_SCORE_ID = PS.ID AND w.USER_ROLE IN (' Chief judge ', ' Team members ')) * PS.STANDARD_WORKING_DAY, 2) *
CASE WHEN SW.USER_ROLE = ' group leader ' THEN 1 ELSE SW.DIVISION_COEFFICIENT END *
(SELECT t.sjzlxs FROM IAM_REPORT_HEAR_TEMPLATE t WHERE t.PROJECT_ID = AP.ID AND ROWNUM = 1), 2) + TO_CHAR(ROUND(nvl(SW.BACK_INTEGRAL, 0), 2), 'fm99999999999990.00') AS Final integral ,
(SELECT WM_CONCAT(h.HSJF_ADJUST_REASON) FROM IAM_PROJECT_SCORE_HSJF h WHERE h.WORKLOAD_ID = AP.ID AND USER_NAME = (SW.USER_NAME || '(' || SW.USER_ROLE || ')')) AS Remarks column
FROM IAM_AUDIT_PROJECT AP
LEFT JOIN IAM_MAJOR_AUDIT_UNIT AU ON AU.PROJECT_ID = AP.ID
LEFT JOIN IAM_FORMAL_REPORT FR ON FR.PROJECT_ID = AP.ID
LEFT JOIN IAM_PROJECT_SCORE PS ON AP.ID = PS.AUDIT_ID
LEFT JOIN IAM_PROJECT_SCORE_WORKLOAD SW ON SW.PROJECT_SCORE_ID = PS.ID
WHERE SW.USER_NAME LIKE '%${userName}%'
AND AU.UNITID in ('${unit_id}')
AND FR.PUBLISH_TIME >= TO_DATE('${startDate}', 'yyyy-mm-dd') AND FR.PUBLISH_TIME <= TO_DATE('${endDate}', 'yyyy-mm-dd')
AND AP.PROJECT_NAME LIKE '%${projectName}%'
边栏推荐
- Dot screen precautions
- Small sample learning data set
- Prime Ring Problem
- NiO simple example
- 1.30 升级bin文件添加后缀及文件长度
- [RTOS training camp] learn C language from a higher perspective
- Diablo: immortality mobile game how to open more brick moving and novice introduction brick moving strategy
- 动态IP地址是什么?为什么大家会推荐用动态ip代理?
- 8、学习MySQL 创建数据表
- [software development specification II] prohibited item development specification
猜你喜欢

格式化JS代码,调试JS代码

Docker高级篇-Mysql主从复制

Google Gson用法详解

【纪中】2022.7.16 1432.输油管道

Leetcode537. Complex multiplication (yes, solved)

记一次自定义 Redis 分布式锁导致的故障

加载dll失败

Game thinking 17: Road finding engine recast and detour learning II: recast navigation grid generation process and limitations
![[secsha concept] large and small end](/img/1e/d295a6eb7ecaccb53ed9f7d2234956.png)
[secsha concept] large and small end

MulDA: A Multilingual Data Augmentation Framework for Low-Resource Cross-Lingual NER 阅读笔记
随机推荐
Failed to load DLL
How can MySQL just duplicate data?
android sqlite先分组后排序左连查询
Iftnews | suppose this is what the metauniverse looks like 20 years later
链表相关面试题
[Go]三、最简单的RestFul API服务器
加载dll失败
Tutorial on principles and applications of database system (055) -- MySQL query (XVII): usage of mathematical functions
数据库系统原理与应用教程(053)—— MySQL 查询(十五):字符型函数的用法
Four common simple and effective methods for changing IP addresses
TV software burning
[Jizhong] July 16, 2022 1432. Oil pipeline
ORACLE——iSupplier 门户开票错误
[RTOS training camp] I2C and UART knowledge and preview arrangement + evening class questions
[data mining] differences, advantages and disadvantages between generative model and discriminant model
What are the ways to quickly improve programming skills in the process of programming learning?
Pycharm automatically adds header comments when creating py files
Test questions and answers of the latest Beijing Construction eight (materialman) mock examination in 2022
How does the proxy IP server ensure its information security in the network
Diablo: immortality mobile game how to open more brick moving and novice introduction brick moving strategy