我有这个问题:
SELECT KDX_PostalAddress_Country,
COUNT(KDX_Id) * 100 /
(SELECT COUNT(KDX_Id)
FROM ___Kardex) AS KDX_CountryPercentage,
COUNT(KDX_Id) AS KDX_CountryCount
FROM ___Kardex
WHERE KDX_HotelId=:hotel_id
GROUP BY KDX_PostalAddress_Country
ORDER BY KDX_CountryPercentage DESC
实际上KDX_PostalAddress_Country会返回国家/地区代码,例如CA,FR,IT。
如何添加包含所有城市代码的新表:
表格为___CountryList
:
CTY_Code
(CA,FR,IT)
CTY_en
(加拿大,法国,意大利)
感谢。