如何在第二個子選擇中的第一個子選擇中使用END_DATE/START_DATE ?,所提供的值僅爲示例。 (06/01/2010)。ORACLE中的SQL Where子句
SELECT "PROJECT"."ID",
"PROJECT"."CLIENT",
"PROJECT"."NAME",
"PROJECT"."STATE",
"PROJECT"."EARLIEST_START",
"PROJECT"."LATEST_END",
"PROJECT"."EFFORT",
"PROJECT"."LINK",
"PROJECT"."STATUS",
"PROJECT"."DESCRIPTION",
(SELECT SUM((END_DATE - START_DATE + 1) * (WORKLOAD/100))
FROM WORKITEM WHERE PROJECT = PROJECT.ID
) AS "P_A",
(SELECT COUNT(*)
FROM PUBLIC_HOLIDAY
WHERE HOLIDAY_DATE BETWEEN TO_DATE('06/1/2010','MM/DD/YYYY') AND
TO_DATE('06/2/2010','MM/DD/YYYY')) AS P_B,
"PROJECT_STATE"."STATE",
"PERSON"."DISPLAY_NAME" AS "RESPONSIBLE"
FROM "PROJECT"
INNER JOIN "PROJECT_STATE" ON PROJECT.STATE = PROJECT_STATE.ID
INNER JOIN "PERSON" ON RESPONSIBLE = PERSON.ID
WHERE (PROJECT.CLIENT = '1') AND (PROJECT.STATE = 1)
ORDER BY "PROJECT"."NAME" ASC
我不知道你問一個辦法 - 請澄清問題。 – 2010-06-10 07:14:22
對不起,很難解釋,希望這有助於.. – opHASnoNAME 2010-06-10 07:17:28
對不起,難以回答:-)。嚴重的是,再次嘗試制定以問號結尾的句子。請包含一個創建表並插入一些示例數據和預期輸出。 – 2010-06-10 07:36:18