RCustomerId   GiftRegistryId   ContactId   DateActive   DateExpire 
-----------   --------------   ---------   ----------   ----------
62            66               225         NULL         2010-10-11 
62            66               228         2010-10-13   NULL 
62            67               229         NULL         2010-10-20 
62            67               230         2010-10-21   NULL 
62            68               232         NULL         NULL 
To check today date is >= dateexpire
if it is >= i want to check same giftregistryid dateactive date wheather is >= or not.
if geater then equal i no need to display contactid otherwise display contactid.
Eg :
      Consider today date id 2010-10-11
      result is    Contactid
                    228
                    229