Simple filter

  • I need to filter on my where clause...where class_codes excludes every code from 700-799.

    What is the bext way to write this?

    This is how it is now:

    where

    ln.acct_type = 'ML'

    and

    ln.class_code <> 710

    I need it to be something like

    and

    ln.class_code <> (between 700 - 799)

    Obviuosly not the correct syntax..

  • where ln.acct_type='ML' AND

    (ln.class_code 799)

  • Many Thanks !!!!

  • Doesn't bring back the expected results...

    is there another way to write this?

  • Checkai gave you exactly what you asked for. If it does not work, how about showing us an example of some data that you want filtered out that this solution is not filtering out for you. Here's a link on how to properly form a post to get the best, fastest help. We'll need table DDL and readily consumable test data to continue.

    http://www.sqlservercentral.com/articles/Best+Practices/61537/"> http://www.sqlservercentral.com/articles/Best+Practices/61537/

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • Yes he did and I'm grateful.

    My verbage was entirly incorrect. I apologize, rough weekend.

    Using his method the proc is reeeeally slow, is ther another way to write the same thing but may run faster?

  • What does the query plan look like? Do you have an index on the account type or class code columns?

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • does that mean you'll be updating your verbage to get an answer that you're interested in?

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply