2
我有以下PostgreSQL的查詢:PostgreSQL的錯誤:「未能找到未知的轉換函數將文本」
with A as
(
select '201405MASE04' as TestID, Count(*) TotQ, Count(distinct Case When SE1 = '' then NULL else SE1 end) TotSE,
case when Count(*)=0 then 7 else Count(distinct RC) end TotRC
from eivTestItems TI, eivTests T
where TI.Test_ID = T.Test_ID
and T.Test_Type_ID = 1
and T.Test_ID= '201405MASE04'
and TI.Omit <> 1
),
B as
(
select '201405MASE04' as TestID, Count(*) TotQ
from eivTestItems TI, eivTests T
where TI.Test_ID = T.Test_ID
and T.Test_Type_ID = 1
and T.Test_ID= '201405MASE04'
and TI.Omit = 1
),
C as
(
select '201405MASE04' as TestID, Count(*) TotQ
from eivTestItems TI, eivTests T
where TI.Test_ID = T.Test_ID
and T.Test_Type_ID = 1
and T.Test_ID= '201405MASE04'
and TI.Question_Type_ID='2'
)
Select A.TestID, A.TotQ + coalesce(B.TotQ,0) - coalesce(C.TotQ,0) as TotQ, A.TotSE, A.TotRC
From A
left outer Join B on A.TestID = B.TestID
left outer Join C on A.TestID = C.TestID
當我試圖運行此查詢,它扔我下面的錯誤:
ERROR: failed to find conversion function from unknown to text
********** Error **********
ERROR: failed to find conversion function from unknown to text
SQL state: XX000
如何找出我在哪裏得到轉換錯誤?
真棒謝謝你..工作很棒 – Abhishek 2014-09-10 17:11:28