• BFSTEP (8/1/2013)


    I am in a time crunch, many things on my plate today, and I just can't seem to get this problem, thought I would toss it out to the forum, and someone would easily see the answer.

    My Table looks like this:

    AttribID FormatID

    -------- ---------

    12 34

    15 34

    19 34

    25 34

    12 49

    15 49

    27 49

    I want to basically query the table like this: Give me FormatID when AttribID=12 AND AttribID=15 AND NOT AttribID = 27, and I want to get back one answer:34

    I know it is a grouping issue, but I am not getting the exact syntax, and am running out of time. Can anyone see the obvious solution that I am missing :angry:

    Thanks

    Brian

    It's not a grouping issue - it is a logical issue.

    It's impossible for AttribID to be equal to 12 AND 15 at the same time, and if it is 12 or 15 that it cannot be 27, so no need to check this.

    May be you need something like that:

    SELECT DISTINCT FormatID FROM [YourTable] WHERE AttribID IN (12,15)

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]