Reputation: 133
I'm trying to compare 2 existing columns in a PLSQL query and capture the result in a new field called "SEEN".
Its throwing an error, I'm sure I'm missing something basic here.
The line in question is:
LAST_TOUCH == USER_ID AS SEEN,
Here is the query:
SELECT distinct CASE_ID, CASE_ID as ID,
NAME AS PRIORITY,
FNN,
NRF_CONTRAVENTION_ID as CURRENTNRF,
CUSTOMER_NAME,
-- user_id AS OWNER, -- you should be using ownerid
from esd_database -- Apoorva
TO_CHAR(TO_DATE(LASTMODIFIEDDATE,
'YYYY-MM-DD HH24:MI:SS'), 'DD-MON-YYYY HH24:MI:SS') as UPDATEDATE,
LAST_TOUCH,
ROUND(CURRENT_DATE - CREATEDDATE) AS WDO,
STATUS,
REQUIRED_DATE AS FIELD_APT_DATE,
-- Apoorva/Deepa, please check my join here in the V_NRF_TABLE_TE
ESA,
FSA,
REGION,
LAST_TOUCH == USER_ID AS SEEN,
case when followupNOTES is not null then SUBSTR(followupNOTES, 0, 40)
|| ' ...'
end notes
from V_NRF_TABLE_TE
where
:userid = user_id
-- previously=> user_id = :userid
and status != 'Complete'
and function = 'TE'
ORDER BY WDO DESC
Upvotes: 0
Views: 24
Reputation: 31716
There's no '=='
operator in SQL and you may not have a boolean expression as a column in Oracle in a select statement (SQL).
You could use a CASE WHEN
expression
CASE WHEN LAST_TOUCH = USER_ID THEN 1 ELSE 0 END as seen
Upvotes: 2