SQL statement for search utility

Discussion in 'Databases' started by t7584, Mar 8, 2006.

  1. #1
    I want to create a search utility and it's necessary to write SQL statement.

    Is this correct? - sSQL="SELECT * FROM r1 ORDER BY ID DESC WHERE r1.message LIKE '%" & strInputSearch & "%';"
    Or like this? - sSQL="SELECT * FROM r1 WHERE r1.message LIKE '%" & strInputSearch & "%' ORDER BY ID DESC;"
     
    t7584, Mar 8, 2006 IP
  2. vectorgraphx

    vectorgraphx Guest

    Messages:
    545
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #2
    put your order by clause at the end, as in your second example.
     
    vectorgraphx, Mar 8, 2006 IP