sql:函式:replace()
阿新 • • 發佈:2018-12-16
sql只查一次未優化
SELECT * FROM ( SELECT COUNT(company_name) AS countnum, company_name, tel_tru, tel_full FROM ( SELECT company_name, tel_full, case when length(tel_l)<=12 then RIGHT(tel_l,7) when length(tel_l)>12 then RIGHT(tel_l,12) end tel_tru FROM ( SELECT company_name, REPLACE(tel,' ','') tel tel_full FROM t_contact) a ) b GROUP BY tel_tru ) c WHERE countnum >= 10 |