>I need something like this
 >
 >Name                   Date                      Days betwen Previous date
 >----------------------------------------------------------------------
 >Name1                 date1                    0
 >Name2                 date2                    date2-date1
 >Name3                 date3                    date3-date2

I agree with Thomas in that EXECUTE BLOCK is probably the best solution, 
but an (inferior) alternative is:

SELECT T1.Name, T1.MyDate, coalesce(T1.MyDate - (SELECT MAX(T2.MyDate) 
FROM MyTable T2 WHERE T1.MyDate > T2.MyDate), 0)
FROM MyTable T1

The main reason for me calling it inferior, is that it will be slow for 
large tables without additional selective WHERE criteria for T2.

HTH,
Set


------------------------------------

------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/firebird-support/join
    (Yahoo! ID required)

<*> To change settings via email:
    firebird-support-dig...@yahoogroups.com 
    firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/

  • [firebir... 'Piotr Olszewski' piotr.olszew...@eskrzynka.pl [firebird-support]
    • Re:... Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
      • ... 'Piotr Olszewski' piotr.olszew...@eskrzynka.pl [firebird-support]
      • ... 'Thomas Steinmaurer' t...@iblogmanager.com [firebird-support]
    • Re:... setysvar setys...@gmail.com [firebird-support]
    • Re:... Michal Kurczabinski michk...@gmail.com [firebird-support]
      • ... Piotr Olszewski piotr.olszew...@eskrzynka.pl [firebird-support]

Reply via email to