1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Sql Query Help - ASP

Discussion in 'C#' started by cancer10, Nov 6, 2006.

  1. #1
    Hello,
    I am developing a simple calender in ASP which will display the next upcoming birthday of my member. Just like some forum have.

    I have a table which has 2 column

    cname | dob
    -------------------
    Joe | 9/12/1982
    Mathew | 2/17/1997
    Pat | 8/23/1880

    -------------------
    What SQL Query should I use to get the name of that person?

    Some basic information:

    Database = Access (may be I can upgrade it into SQL Server 2000)

    Date Format in database = mm/dd/yyyy
     
    cancer10, Nov 6, 2006 IP
  2. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #2
    you need to use the Query SELECT ***** WHERE ******
     
    ludwig, Nov 7, 2006 IP
  3. N_F_S

    N_F_S Active Member

    Messages:
    2,475
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    90
    #3
    SELECT * from table WHERE dob > CURDATE() ORDER BY dob ASC LIMIT 1;

    that's an example, from there you can sort/modify it to your needs. Not sure if CURDATE() works in access as Im working with mysql.
     
    N_F_S, Nov 7, 2006 IP
  4. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #4
    maybe its better to have
    dob = '"&formatdatetime(DATE())&"'
     
    ludwig, Nov 7, 2006 IP
  5. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #5
    anyway he can use it
    I know what type of function it is and I use it which WORKS just fine, he can change the date time value automatically to the one he has in his DB which will make his work easier
     
    ludwig, Nov 8, 2006 IP
  6. N_F_S

    N_F_S Active Member

    Messages:
    2,475
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    90
    #6
    that's what I was thinking as well, query not formatting.
     
    N_F_S, Nov 8, 2006 IP