Results 1 to 2 of 2

MS SQL Query conditions, multiple criteria within criteria

Threaded View

Speshul MS SQL Query conditions,... 07-29-2014, 10:17 AM
Speshul Re: MS SQL Query conditions,... 07-29-2014, 12:16 PM
  1. #1
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    MS SQL Query conditions, multiple criteria within criteria

    Not sure if SQL is appropriate to post on here but thought I would give it a try.

    I am trying to create a query which will filter results based on multiple criteria.

    So for example,
    Select 
    MyData1, MyData2, MyData3
    
    From 
    MyDataBase
    
    Where 
    MyData1 = "Criteria"
    AND (MyData2= NOT LIKE '%AGR%' AND MyData3 <> "AB")
    AND (MyData1= NOT LIKE '%STR%' AND MyData3 <> "CD")
    I want to EXCLUDE any record where BOTH %AGR% is present somewhere within MyData2, AND MyData3 is AB
    I want to EXCLUDE any record where BOTH %STR% is present somewhere within MyData1, AND MyData3 is CD
    However, if %STR% or %AGR% is present with a MyData3 value of "EF", it WILL list.

    I can't figure out if my method of testing this is flawed or if the syntax is incorrect, could someone please verify?
    Last edited by Speshul; 07-29-2014 at 10:19 AM.
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Dlookup Query with multiple criteria
    By irfanparbatani in forum Access Tables & Databases
    Replies: 9
    Last Post: 07-30-2014, 10:42 AM
  2. How to get multiple criteria in query?
    By jgomez in forum Access Tables & Databases
    Replies: 2
    Last Post: 09-06-2013, 01:57 PM
  3. VBA - Lookup with multiple conditions/criteria
    By dluhut in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-02-2013, 12:42 PM
  4. VBA - Lookup with multiple conditions/criteria
    By dluhut in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-02-2013, 09:21 AM
  5. Criteria With Multiple Conditions
    By patrickargao in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-04-2012, 11:31 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1