SELECT
Count (case if Shenfenid like "11%" then "Beijing" end) Beijing,
Count (case if Shenfenid like "12%" then "Tianjin" end) Tianjin,
Count (case if Shenfenid like "13%" then "Hebei" end) Hebei,
Count (case if Shenfenid like "14%" then "Beijing" end) Shanxi,
Count (case if Shenfenid like "15%" and then "Inner Mongolia" end) Inner Mongolia,
Count (case if Shenfenid like "41%" then "Henan" end) Henan
From Lp_lianpiao
$result = M (' Lianpiao ')->field (' Count (case is shenfenid like "11%" then "Beijing" end) Beijing,
Count (case if Shenfenid like "12%" then "Tianjin" end) Tianjin,
Count (case if Shenfenid like "13%" then "Hebei" end) Hebei,
Count (case if Shenfenid like "14%" then "Shanxi" end) Shanxi1,
Count (case if Shenfenid like "15%" and then "Inner Mongolia" end) Neimenggu,
Count (case if Shenfenid like "21%" then "Liaoning" end) Liaoning,
Count (case if Shenfenid like "22%" then "Jilin" end) Jilin,
Count (case if Shenfenid like "23%" then "Heilongjiang" end) Heilongjiang,
Count (case if Shenfenid like "31%" then "Shanghai" end) Shanghai,
Count (case if Shenfenid like "32%" then "Jiangsu" end) Jiangsu,
Count (case if Shenfenid like "33%" then "Zhejiang" end) Zhejiang,
Count (case if Shenfenid like "34%" then "Anhui" end) Anhui,
Count (case if Shenfenid like "35%" then "Fujian" end) Fujian,
Count (case if Shenfenid like "36%" then "Jiangxi" end) Jiangxi,
Count (case if Shenfenid like "37%" and then "Shandong" end) Shandong,
Count (case if Shenfenid like "41%" then "Henan" end) Henan,
Count (case if Shenfenid like "42%" then "Hubei" end) Hubei,
Count (case if Shenfenid like "43%" then "Hunan" end) Hunan,
Count (case if Shenfenid like "44%" then "Guangdong" end) Guangdong,
Count (case if Shenfenid like "45%" then "Guangxi" end) Guangxi,
Count (case if Shenfenid like "46%" then "Hainan" end) Hainan,
Count (case if Shenfenid like "50%" then "Chongqing" end) Chongqing,
Count (case if Shenfenid like "51%" then "Sichuan" end) Sichuan,
Count (case if Shenfenid like "52%" then "Guizhou" end) Guizhou,
Count (case if Shenfenid like "53%" then "Yunnan" end) Yunnan,
Count (case if Shenfenid like "54%" then "Tibet" end) Xizang,
Count (case if Shenfenid like "61%" then "Shaanxi" end) Shanxi3,
Count (case if Shenfenid like "62%" then "Gansu" end) Gansu,
Count (case if Shenfenid like "63%" then "Qinghai" end) Qinghai,
Count (case if Shenfenid like "64%" then "Ningxia" end) Ningxia,
Count (case if Shenfenid like "65%" then "Xinjiang" end) Xinjiang ')->select ();
SQL case-when; and use in thinkphp