Reputation: 1
I am getting a keyword error for this sql. i dont know which part went wrong. i been trying to figure the problem since morning. This query is to get the latest information of subscribers from multiple table. any help would be appreciated
SELECT
g.msisdn, c.name3, c.id_number,
decode(g.sub_state, 'B01', 'Active', 'B02', 'Close', 'B03', 'Suspend','B02', 'Barring') STATUS,
decode(g.prepaid_flag, '0', 'Prepaid', '1', 'Postpaid','3', 'Hybrid') RATING,
d.offer_name, t.create_date
FROM inf_subscriber_all g
INNER JOIN (
SELECT a.*, RANK() OVER(PARTITION BY cust_id ORDER BY create_date) rn
FROM his_offers
) as a ON a.cust_id = g.cust_id AND a.rn = 1
INNER JOIN inf_customer_all c ON c.cust_id = a.cust_id
INNER JOIN pdm_offer d ON d.offer_id = a.offer_id
WHERE g.msisdn IN ('135018013','197745505','195154724')
Upvotes: 0
Views: 293