Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Posts
    1

    Angry Unanswered: The WHERE clause

    Hi, I just wanted to ask if this statement is right:

    strSQL="SELECT * FROM Bidder WHERE 'BIDDER_ID=" & strBidderID & "' and 'BIDDER_ACCOUNT_ACTIVATED=yes' AND 'BIDDER_STATUS=UNBLOCKED';"

    Can we give AND a number of times in a WHERE CLAUSE?

  2. #2
    Join Date
    Aug 2004
    Posts
    7

    Cool

    strSQL="SELECT * FROM Bidder WHERE 'BIDDER_ID=" & strBidderID & "' and 'BIDDER_ACCOUNT_ACTIVATED=yes' AND 'BIDDER_STATUS=UNBLOCKED';"

    No dear the above statement u mentioned is wrong....cauz value should be passed withing single quote (') if its datatype is not numeric. Remember whatever u mentioned in a single quote sql server read it as a constant or value. hence u must give field name out side the single quote. your query should be like below.

    strSQL="SELECT * FROM Bidder WHERE BIDDER_ID='" & strBidderID & "' and BIDDER_ACCOUNT_ACTIVATED='yes' AND BIDDER_STATUS='UNBLOCKED'"


    Yes you can give AND number of times in where clause.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •