我收到此sql的关键字错误。我不知道哪一部分出了问题。我一直在想 自早上以来的问题。 该查询是从多个表中获取订户的最新信息。任何帮助将不胜感激
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')
答案 0 :(得分:1)
只需从as
中删除) as a ON
。应该只是) a ON