AND's and OR's

Results 1 to 3 of 3

Thread: AND's and OR's

  1. #1
    Join Date
    Dec 1969

    Default AND's and OR's

    I am trying to change the search string I have from search "field 1" AND "field 2" to Search "field 1" and "field 2" or "field 3". The trick being no matter what it has to search field 1, then field 2 and if it doesn&#039;t find anything in field 2, then search field 3. This is what I got so far. I&#039;ve tried a few combinations, but I can&#039;t get it to work correctly.<BR><BR>SS = REQUEST("state")<BR>CC = REQUEST("cert")<BR><BR>SQLSELECTION="SELECT * FROM Names "<BR>SQLSELECTION=SQLSELECTION & "WHERE state=&#039;"& SS & "&#039; AND certi=&#039;"& CC & "&#039; "<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: AND's and OR's

    well,<BR><BR>do you ever need to ignore field3 even if field2 returns data? if not then this should work:<BR><BR>select fields <BR>from table <BR>where (field1 = @something1) and ( field2 = @something2 or field2 = @something3)

  3. #3
    Join Date
    Dec 1969

    Default brackets matter

    &#062;&#062; Search "field 1" and "field 2" or "field 3"<BR>may mean one of these two filters:<BR><BR>where (field1=x AND field2=y) OR (field3=z)<BR>or<BR>where (field1=x) AND (field2=y OR field3=z)<BR><BR>use the one that suits your need.<BR>

Posting Permissions

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