SQL Command....need help please!

Results 1 to 3 of 3

Thread: SQL Command....need help please!

  1. #1
    Join Date
    Dec 1969
    Posts
    18

    Default SQL Command....need help please!

    Is it possible to have an AND and a OR in the SQL command like the following:<BR><BR>SQLquery = "Select * FROM [news] WHERE date = &#039"& date &"&#039 AND month like &#039"& month &"&#039 AND people=&#039Sales&#039"<BR><BR>that command does not work but how can I get it to work? Does anyone know?

  2. #2
    roland trepanier Guest

    Default RE: SQL Command....need help please!

    try this syntax:<BR><BR>sql = "SELECT * FROM table WHERE champ1 = " & "&#039" & val1 & "&#039"<BR> & " and champ2 = " & "&#039" & val2 & "&#039" <BR>

  3. #3
    dclark Guest

    Default RE: SQL Command....need help please!

    One trick I&#039ve used is to put ( ) around the statements between the ANDs and/or ORs. Using ( )&#039s will allow you to incorporate AND and OR into the same WHERE statement.<BR><BR>Example: ...WHERE (date = &#039" & date & "&#039) AND (month like &#039" & month & "&#039) AND (people = &#039" & sales & "&#039)"

Posting Permissions

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