下面是我的查询,我在其中尝试组合多个列值
SELECT DISTINCT CONVERT(varchar, Em.ADDR1) - CONVERT(varchar, Em.ADDR2) - CONVERT(varchar, Em.ADDR3) - CONVERT(varchar, Dm.DIST_NAME) - CONVERT(varchar,Sm.STATE_NAME)
- CONVERT(varchar, Cm.COUNTRY_NAME) AS Expr1
FROM EMP_MST AS Em INNER JOIN
DESIG_MST AS Dsgm ON Em.DESIG_NO = Dsgm.DESIG_NO AND Dsgm.COMPANY_NO = Em.COMPANY_NO INNER JOIN
DEPT_MST AS Dptm ON Em.DEPT_NO = Dptm.DEPT_NO AND Dptm.COMPANY_NO = Em.COMPANY_NO INNER JOIN
COUNTRY_MST AS Cm ON Em.COUNTRY_NO = Cm.COUNTRY_NO INNER JOIN
STATE_MST AS Sm ON Em.STATE_NO = Sm.STATE_NO AND Em.COUNTRY_NO = Sm.COUNTRY_NO INNER JOIN
DIST_MST AS Dm ON Em.DIST_NO = Dm.DIST_NO AND Em.STATE_NO = Dm.STATE_NO AND Em.COUNTRY_NO = Dm.COUNTRY_NO LEFT OUTER JOIN
EMP_MST AS MEm ON Em.MANAGER = MEm.EMP_NO
WHERE (1 = 1) AND (Em.EMP_NO LIKE '%%') AND (Em.COMPANY_NO = 1)
当我执行 Query 时,我得到
错误:
操作数数据类型 varchar 对 sqlServer 中的减法运算符无效