SimpleIntelligence
asked on
ORA-000920 Error for Query
I want my filter to say
Where it is LI
or where it is PL and hasn't occurred yet
or where it is PG and has occurred
I'm putting the brackets in wrong. Please advise.
Where it is LI
or where it is PL and hasn't occurred yet
or where it is PG and has occurred
I'm putting the brackets in wrong. Please advise.
SELECT account_reference, key_type, ice_customer_id, base_id, premise_id, base_type, start_date, end_date, product_status, end_reason, domain
FROM (SELECT ice1.*,
1 AS domain
FROM ice1.base ice1
UNION ALL
SELECT ice2.*,
2 AS domain
FROM ice2.base ice2)
WHERE key_type IN (1,2,14,15)
AND (product_status ='LI' OR (product status ='PL'
AND start_date<SYSDATE)
OR (product_status ='PG'
AND start_date>SYSDATE));
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
FROM (SELECT ice1.*,
1 AS domain
FROM ice1.base ice1
UNION ALL
SELECT ice2.*,
2 AS domain
FROM ice2.base ice2)
WHERE key_type IN (1,2,14,15)
AND
((product_status ='LI') OR (product status ='PL' AND start_date<SYSDATE) OR (product_status ='PG' AND start_date>SYSDATE));