Click here to Skip to main content
15,896,606 members

Comments by ajitha.pusapati (Top 46 by date)

ajitha.pusapati 29-Jun-11 2:49am View    
Thanks for ur reply. its very nice.
I prepate quary like the following. but i con't do two tings in that.

SELECT memNo,memberName,[18] AS LockerRent, [19] AS SubscriptionFees
FROM
(select c.ID as cid ,c.Membershipnumber as memNo,c.Name as memberName, mi.ID as ItemId, mi.Name as ItemName,mb.Amount as Amount from MemberMonthlyBill mb, MemberBill m ,MemberItems mi,Customer c
where mb.ItemID=mi.ID and m.ItemID=mi.ID and mb.BillingMonth=m.BillingMonth and m.CustomerID=c.ID and mb.CustomerID=c.ID and
mb.BillingMonth>='2011-04-1' and mb.BillingMonth<='2011-04-30') p
PIVOT
(
sum(Amount)
FOR ItemId IN
( [18], [19])
) AS pvt
ORDER BY pvt.cid;

1. except 18 and 19, for remaining item ids item name is Other.
2. it show multiple record for one customer .

result is
MemNo MemName LockerRent SubscriptionFees
A001 MR.A.V.R.K.KUMAR 25.00 NULL
A001 MR.A.V.R.K.KUMAR NULL 441.20
A002 MR. M. ADISANKAR NULL 441.20
A003 MR. ASHOK KUMAR GUPTA 25.00 NULL
A003 MR. ASHOK KUMAR GUPTA NULL 441.20
ajitha.pusapati 29-Jun-11 1:45am View    
Deleted
Question updated
ajitha.pusapati 22-Jun-11 8:37am View    
thanks this is really helpful.
ajitha.pusapati 9-Jun-11 8:36am View    
can u explain clearly.

ajitha.pusapati 9-Jun-11 6:38am View    
so nice.. Thanks..
for next line <br />.
for space ?.