Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 help with a query

Author  Topic 

tripathibhupesh
Starting Member

10 Posts

Posted - 2006-04-24 : 10:55:25
hi all
i have two tables accounts and payments related with an accountid
accounts(accid,balance...)
payments(accid,payment,timestamp..)

what i am trying to do is report all the accounts whose balance is -ve
with days since last payments

i tried achieving this by a join query
now my prob is
i want to even display records that are not present in payments ie no
payments are made in that account n display no payments or something else
eg
accountid balance lastpayments
1 -150 3 days
2 -200 4 days
3 -90 No Payments


please help
thanks

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-04-24 : 10:59:05
I think left join payments & use of Case - When Payment is Null - Then ... will work for u

Srinika
Go to Top of Page
   

- Advertisement -