ID Dateofbirth
001 01/01/1988 'dd/mm/yyyy
002 01/05/2001
....
從表1,我想找到最近的每個ID的生日。最近的生日應該用系統日期進行驗證。
預期輸出
ID Dateofbirth MostRecentBirthday
001 01/01/1988 01/01/2012
002 01/05/2001 01/05/2011
....
輸出中解釋
For 001, most recent birthday is 01/01/2012
For 002, most recent birthday is 01/05/2011 ' because still we are not reached this date 01/05/2012
列數據類型是DateTime還是VARCHAR? – Seph 2012-03-06 06:07:39
閏日呢?你想怎麼處理? – 2012-03-06 07:23:13