Tuesday, 15 June 2010

sql - Report Next Date in Sequence -


Our database keeps track of only 5 billing payments each month. How can I write a selected statement on each payment received date,

Which are sequentially seen and if a date is filed for going to the next payment, etc. ... then finally come with an empty field and report that date?

I have tried the following case statement but I think I am on the wrong track; Select db.identifier, case when recdate1 is not empty, then recdate1 recdate2 is not empty then recdate2 is when recdate3 is not zero, again recdate3 end

DB

You should use COALESCE function for this COALESCE function takes the number of input fields, And the first tap returns the input field from left to right. In other words, if you index the recdate field from recdate 1 to recdate 1, then this one is the first one Apas who will not tap.

Here is the code to get it. As a SEC, there is a link to the COALESCE function for more information as SELECT db.identifier, COALESCE (recdate1, recdate2, recdate3, recdate4, recdate5)

Hope it helps.


No comments:

Post a Comment