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
 SQL Server Development (2000)
 asending problem of two cols

Author  Topic 

RoniDxb
Starting Member

28 Posts

Posted - 2008-08-05 : 06:52:51
Table CustLedger

AccNo.....VisaRecDate..PpNo....Price..PaymentDate..PaymentNo..AmtRec.
001-0002..Null..........Null....Null.2008-08-03....5........3000
001-0002..2008-08-01...AB1012..1500...Null.........Null.......Null.
001-0002..2008-08-01...AB1012..1500...Null.........Null.......Null.
001-0001..2008-08-02...AB1012..1500...Null.........Null.......Null.
001-0002..2008-08-01...AB1012..1500...Null.........Null.......Null.
001-0002..2008-08-04...AB1012..1500...Null.........Null.......Null.
001-0002..2008-08-03...AB1012..1500...Null.........Null.......Null.

I want to select recods with respect to AccountNo Order by VisaRecDate and PaymentDate for example if i select record w.r.t
AccountNo 001-0002,
result should be like this

AccNo.....VisaRecDate..PpNo....Price..AmtRec..Descriptions
001-0002..2008-08-01...AB1012..1500...Null....Null..........
001-0002..2008-08-01...AB1012..1500...Null....Null.........
001-0002..2008-08-01...AB1012..1500...Null....Null..........
001-0002..2008-08-03...AB1012..1500...Null....Null..........
001-0002..Null.........Null....Null...3000..PmtDate 2008-08-03,Pmt#5
001-0002..2008-08-04...AB1012..1500...Null....Null.........

plz guide me
Plz note in result 3000 value is in AmtRec col
bcoz of formatting problem it does not look at its actual position

Jim77
Constraint Violating Yak Guru

440 Posts

Posted - 2008-08-05 : 11:08:32
Order by VisaRecDate,PaymentDate desc
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-05 : 13:40:27
order by coalesce(VisaRecDate,PaymentDate)
Go to Top of Page

RoniDxb
Starting Member

28 Posts

Posted - 2008-08-05 : 14:55:45
quote:
Originally posted by visakh16

order by coalesce(VisaRecDate,PaymentDate)



Yes thanks Visakh ,It works successfully.
Go to Top of Page
   

- Advertisement -