Fetching data from table

Discussion in 'MySQL' started by beven, Dec 18, 2009.

  1. #1
    Hi,
    I have a table consisting five columns Card No, Sdate, Edate, ATime, Etime

    Now i want to get three columns info CardNo, Sdate, Edate from table. But i am facing problem when i get input from user to get their required info. For example user want to exact CRad name & his info from a specific Sdate to Edate.
    Any effort will be appreciated
     
    beven, Dec 18, 2009 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Following might help.. If SDate and EDate are date type columns..

    SELECT CardNo, SDate, EDate FROM table WHERE SDate > INPUT_DATE AND EDate < INPUT_DATE

    Alternately better method is..

    SELECT CardNo, SDate, EDate FROM table WHERE INPUT_DATE BETWEEN SDate AND EDate
     
    mastermunj, Dec 18, 2009 IP
  3. beven

    beven Well-Known Member

    Messages:
    483
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    113
    #3
    Thanks for help.
     
    beven, Dec 19, 2009 IP