Skip to main content
johng58900177
Known Participant
February 20, 2021
Question

Query assistance

  • February 20, 2021
  • 2 replies
  • 260 views

I took this from Access and have used IS NOT.  I took everything out except for "Wal-mart", Changed to Wal-Mart and 'Wal-mart'.  Nothing works unless I take the entire Where clause out.  Any help would be appreciated.

 

WHERE ShipToName NOT ("Wal-Mart" OR "GCC Belvidere IL") AND FOB ="delivered" AND ShipToID Not ("MAN-002" OR "OXN-001" OR "WAT-001")))

    This topic has been closed for replies.

    2 replies

    Participating Frequently
    February 21, 2021

    As Charlie says the databsae you are using is important to know but your query in SQL that is applicable to most DB's could use lists and look something like 

     

    WHERE ShipToName NOT IN ('Wal-Mart', 'GCC Belvidere IL') AND FOB = 'delivered' AND ShipToID NOT IN  ('MAN-002', 'OXN-001', 'WAT-001')

     

    The parentheses is your where clause do not match up, you have extra on the end, so is there more than you posted here?

     

     

     

     

     

     

    Charlie Arehart
    Community Expert
    Community Expert
    February 20, 2021

    You say you "took this from Access". What's not clear is what db you are running it against now. Is it Access? Mysql? Sql server? Something else?

     

    Note that standard sql uses <> for not equal (rather than "not").

     

    Also, most dbs require using single quotes rather than double quotes for strings.

     

    Can you let us if those pointers help? Or again tell us the dbms you're using. 

    /Charlie (troubleshooter, carehart. org)
    johng58900177
    Known Participant
    February 21, 2021

    MS SQL.  Sorry about that.