GROUP BY Help - Pass Through

G

Guest

Hi all,

I am having trouble grouping by 2 values in a pass through query. I seem to
be getting duplicate returns, however when I run this as a simple access
select query, I do not get duplicate returns.

SELECT

contract.contractcode,
contract.lcontrans,
contract.lcondesc,
mast.poolmastcode,
mast.poolmastdesc,
[lcontrans]+45 AS Expiration,
Sum(gross_amt) AS SumOfgross_amt

FROM

server..eco_loan_map as map (NOLOCK)
INNER JOIN server..eco_lcontract as contract (NOLOCK) ON map.contractcode =
contract.contractcode
INNER JOIN server..eco_poolmast as mast (NOLOCK) ON map.pool =
mast.poolmastcode
INNER JOIN server..eco_charges_master as charges (NOLOCK) on map.loannum =
charges.loannum

WHERE

charges.lchgstype = 9

GROUP BY

contract.contractcode,
contract.lcontrans,
contract.lcondesc,
mast.poolmastcode,
mast.poolmastdesc

There should be unique Sum(gross_amt) AS SumOfgross_amt values based on
contractcode and lcontrans.

Any help would be appeciated.
 
R

Ron Hinds

Off the top of my head - shouldn't you be including Expiration in the GROUP
BY also?

Also you might want to post this in the microsoft.public.sqlserver.server
group since it will actually execute on the server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top