1 2 Previous Next 20 Replies Latest reply on Mar 23, 2016 3:02 PM by user19752

    How can I sort a date via SQL for a list of currnt birthdays?

      Hi,

       

      I want to show all the current birthdays in my CRM in a list of my startup window from, say: today and the next seven days. For that I do use a field that holds all the IDs of the contacts and a the contacts do relate to this list of IDs. The birthdays look like "01.02.2016".

       

      To get the IDs of the contacts that do have birthday in the next days I use an eSQL-statement - but this ne here does not work in two ways:

       

      1. I do also get "old" birthdays before today
      2. they do not sort correctly

       

      SQLAusführen ( "

          SELECT

              DISTINCT ID

          FROM

              contacts

          WHERE

              ( Day ( birthday ) >= ? OR Day ( birthday ) <= ? )

              AND

               Month ( birthday ) = ?

          ORDER BY

              Day ( birthday )

          " 

          ; "" ; ""

          ; WochentagZahl ( Hole ( SystemDatum ) )

          ; WochentagZahl ( Hole ( SystemDatum ) ) + 7

          ; MonatZahl ( Hole ( SystemDatum ) ) 

      )

       

      Any ideas?

        1 2 Previous Next