Subject | Select returns too many columns |
---|---|
Author | mikcaau |
Post date | 2007-03-18T13:03:28Z |
Yet another book keeping routine
this fails
select /*mas.DIRECTION,*/
mas.CUSTID,
Cust.CUST_NAME as Cust_Sup,
count(mas.ID),
case
when mas.DIRECTION = 'CREDIT' then sum( mas.ENTRY_TOTAL)
else 0
end as Credit,
case
when mas.DIRECTION = 'DEBIT' then Sum( mas.ENTRY_TOTAL)
else 0
end as Debit
from TRANS89 mas
left join MACT_CUST_SUP_LIST Cust on Cust.CUSTID = mas.CUSTID
where Cust.CUSTID in ('7', '8', '9')
group by 1, 2/*, 3*/
order by 1
But if I remove the comments it runs ok but I get money direction
which I am trying to avoid.
FB 1.5 win xp server and client
Am I stuck with getting Direction?
Mick
this fails
select /*mas.DIRECTION,*/
mas.CUSTID,
Cust.CUST_NAME as Cust_Sup,
count(mas.ID),
case
when mas.DIRECTION = 'CREDIT' then sum( mas.ENTRY_TOTAL)
else 0
end as Credit,
case
when mas.DIRECTION = 'DEBIT' then Sum( mas.ENTRY_TOTAL)
else 0
end as Debit
from TRANS89 mas
left join MACT_CUST_SUP_LIST Cust on Cust.CUSTID = mas.CUSTID
where Cust.CUSTID in ('7', '8', '9')
group by 1, 2/*, 3*/
order by 1
But if I remove the comments it runs ok but I get money direction
which I am trying to avoid.
FB 1.5 win xp server and client
Am I stuck with getting Direction?
Mick