开发者

Dual Inner Join Query taking forever to run

i would like to runa a query to get some simple stats on our database but it returns the following error. can someone advise me on how to fix it?

query =

SELECT     tblSchemes.Clientid, count(clientid), count(insscheme)
FROM       tblSchemes
 INNER JOIN tblclaims_liberty ON tblClaims_liberty.AgentCode = tblSchemes.ClientID 
 INNER JOIN tblPolicys_liberty ON tblSchemes开发者_如何转开发.Scheme = tblPolicys_liberty.InsScheme
GROUP BY tblSchemes.Clientid

Error returned =

Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type int.

Many thanks in advance.

Adam


You may be exceeding the limit on COUNT, which returns an integer. Try using COUNT_BIG instead as it returns a bigint.


I would suspect a data type mismatch between some of the join fields. It is trying to convert something and that seems the most logical place.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜