当我运行以下查询时,我得到此错误“联合类型文本和Bigint不能匹配“ [英] When I Run Below Query I Am Getting This Error " Union Types Text And Bigint Cannot Be Matched "

查看:945
本文介绍了当我运行以下查询时,我得到此错误“联合类型文本和Bigint不能匹配“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SELECT 
	1 AS STEP
	,'' AS ProviderName
	,'' AS Procedurecode
	,Claimid
	,Patient_First_Name
	,Patient_Last_Name
	,DOS
	,SUM(COALESCE(Total_Charge,0))
	,SUM(COALESCE(PaidAmount,0))
	,PostedDate
	,CheckEFTDate
	,CheckEFTNo 
FROM table_name 
GROUP BY ProviderName,Claimid,Patient_First_Name,Patient_Last_Name,DOS,PostedDate,CheckEFTDate,CheckEFTNo
UNION ALL
SELECT 
	2 AS STEP
	,'' AS ProviderName
	,'' AS Procedurecode
	,COUNT(Claimid)
	,'' AS Patient_First_Name
	,'' AS Patient_Last_Name
	,NULL::date AS DOS
	,SUM(COALESCE(Total_Charge,0))
	,SUM(COALESCE(PaidAmount,0))
	,NULL::date AS PostedDate
	,NULL::date AS CheckEFTDate
	,'' AS CheckEFTNo 
FROM table_name GROUP BY Claimid

推荐答案

如错误所示,您在UNION的两侧都有不匹配的列类型。两个查询之间的列类型必须匹配。



因此,请浏览每一列并将它们相互比较。例如:查询1中的 ClaimId 与查询2中的 COUNT(Claimid)相同的类型
As the error says, you have mismatching column types on both sides of the UNION. The column types between both queries must match.

So go through each column and compare them to each other. For example: Is ClaimId in query 1 same type as COUNT(Claimid) in query 2


这篇关于当我运行以下查询时,我得到此错误“联合类型文本和Bigint不能匹配“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆