我需要從有一個case語句一個選擇,如:PL /從選擇值SQL情況下
select buyer id,
buyer_add
buyer_city,
buyer_state,
, case
when Special_Desc like "%ma%" then "Mail"
when Special_Desc like "%pa%" then "phone"
else " "
end as Special_Handling
from
(select string_func(buyer_id)
from advance.pledge p) Special_Desc
from buyer_info
where..
換句話說,我需要做的是從一個SELECT語句中產生的Special_desc的情況下,
先謝謝您。
謝謝你,我從你的查詢中改變了這個部分:from(select string_func(buyer_id)from advance.pledge p)s,to:from(從advance.pledge p選擇string_func(buyer_id) )special_Desc, 它告訴我缺少右括號和所有parentesis是正確的 – sgg
這是我的實際代碼,但現在它給我'缺少rigth括號,當Sp_Desc喜歡('馬%'),然後'郵件'時Sp_Desc喜歡('PA% ')then'phone'else「」end AS Special_Handling from(string_function(g.buyer_id)from g)AS Sp_Desc – sgg
您不能使用%,這不是正則表達式 – steve