Hi All,
When I run following query
SELECT distinct TOP 50 c.id,
a.UnitQty,
MIN(b.PeriodBeginDt),
MAX(b.PeriodEndDt),
b.SBAmt,
b.BdgAmt,
f.cttypecd
FROM tSBU a, tSB b, tCS c, tcbg e, tctr f
WHERE c.Id = b.Id
AND c.Id = e.Id
AND c.id = f.id
AND c.SeqNum = b.SeqNum
AND c.SeqNum = e.SeqNum
AND c.SeqNum = f.SeqNum
AND a.BillId = b.BillId
AND c.SSeqNum = b.SSeqNum
AND b.PeriodEndDt >= (Select min(PeriodEndDt) From tBS Where MonthDt = '01/01/2003' )
AND b.PeriodEndDt <= (Select max(PeriodEndDt) From tBS Where MonthDt = '05/01/2005' )
group by c.id, a.UnitQty,b.SBAmt, b.BdgAmt, f.cttypecd
order by c.custid, MIN(b.PeriodBeginDt),MAX(b.PeriodEndDt)
I am getting the result as
1 12.3 2003-05-06 2003-06-04 7.93 33.00 RE
1 12.3 2003-05-06 2003-06-04 12.86 23.00 RE
But I am looking for something like this
1 12.3 2003-05-06 2003-06-04 7.93 12.86 33.00 23.00 RE
Any help is very much appreciated.
Thanks.
When I run following query
SELECT distinct TOP 50 c.id,
a.UnitQty,
MIN(b.PeriodBeginDt),
MAX(b.PeriodEndDt),
b.SBAmt,
b.BdgAmt,
f.cttypecd
FROM tSBU a, tSB b, tCS c, tcbg e, tctr f
WHERE c.Id = b.Id
AND c.Id = e.Id
AND c.id = f.id
AND c.SeqNum = b.SeqNum
AND c.SeqNum = e.SeqNum
AND c.SeqNum = f.SeqNum
AND a.BillId = b.BillId
AND c.SSeqNum = b.SSeqNum
AND b.PeriodEndDt >= (Select min(PeriodEndDt) From tBS Where MonthDt = '01/01/2003' )
AND b.PeriodEndDt <= (Select max(PeriodEndDt) From tBS Where MonthDt = '05/01/2005' )
group by c.id, a.UnitQty,b.SBAmt, b.BdgAmt, f.cttypecd
order by c.custid, MIN(b.PeriodBeginDt),MAX(b.PeriodEndDt)
I am getting the result as
1 12.3 2003-05-06 2003-06-04 7.93 33.00 RE
1 12.3 2003-05-06 2003-06-04 12.86 23.00 RE
But I am looking for something like this
1 12.3 2003-05-06 2003-06-04 7.93 12.86 33.00 23.00 RE
Any help is very much appreciated.
Thanks.