私はこのクエリを持っています:
SELECT TO_CHAR(HON.CREATE_DT,'DD-MM-YYYY') as CREATE_DT,
HON.ACCOUNT_NO,(SELECT TO_CHAR(CURRENT_DATE - INTERVAL '7' DAY, 'DD-MM-YYYY') FROM DUAL) AS NV
FROM medium.HONSCRIBERS HON,
medium.HONSCRIBER_TEXT pcode,
medium.ACCESS_NUMBERS accnr
WHERE
accnr.STATUS_CD = 'CU' AND
pcode.TRADING_AS ='7777777'AND
HON.ACCOUNT_NO=pcode.ACCOUNT_NO AND
HON.ACCOUNT_NO=accnr.ACCOUNT_NO
戻ります:
[0] => Array
(
[CREATE_DT] => 28-02-2008
[ACCOUNT_NO] => 20340322
[NV] => 20-05-2011
)
[1] => Array
(
[CREATE_DT] => 28-02-2008
[ACCOUNT_NO] => 20340322
[NV] => 20-05-2011
)
日付を比較する必要がありますCREATE_DTとNV私のクエリ:
SELECT TO_CHAR(HON.CREATE_DT,'DD-MM-YYYY') as CREATE_DT,
HON.ACCOUNT_NO,(SELECT TO_CHAR(CURRENT_DATE - INTERVAL '7' DAY, 'DD-MM-YYYY') FROM DUAL) AS NV
FROM medium.HONSCRIBERS HON,
medium.HONSCRIBER_TEXT pcode,
medium.ACCESS_NUMBERS accnr
WHERE
accnr.STATUS_CD = 'CU' AND CREATE_DT < NV AND
pcode.TRADING_AS ='7777777'AND
HON.ACCOUNT_NO=pcode.ACCOUNT_NO AND
HON.ACCOUNT_NO=accnr.ACCOUNT_NO
このエラーがあります:
[code] => 904
[message] => ORA-00904: "NV": invalid identifier
[offset] => 325
なぜ彼はいつも私に書いたのですか: "NV":無効な識別子?手伝ってくれてありがとう。