locked
EQUAL not EQUAL RRS feed

  • Question

  • Good Experts

    how can I use this LIKE function to bring all customer ID that begins with 00-CA, but I have some records that need to be exempt from. My question is how can I use a not equal to <g class="gr_ gr_375 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" data-gr-id="375" id="375">statement</g> in order to avoid bringing those records

    this is what I use to bring everything

    il.CustID like '00-CA%'

    this <g class="gr_ gr_560 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace gr-progress" data-gr-id="560" id="560">are</g> the record to need to go out

    00-CAPROCK

    00-<g class="gr_ gr_526 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="526" id="526">CAREDIRECT</g>

    thanks 


    guaya81

    Friday, July 13, 2018 9:33 PM

Answers

  • just include an additional exclusion condition

    like

    WHERE il.CustID like '00-CA%'
    AND il.CustID NOT IN ('00-CAPROCK','00-CAREDIRECT')


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    • Marked as answer by guaya81 Friday, July 13, 2018 9:42 PM
    Friday, July 13, 2018 9:35 PM
  • Hi,

    How about?

    ...WHERE il.CustID LIKE '00-CA%' AND il.CustID <> '00-CAPROCK' AND  il.CustID <> '00-CARDIRECT'

    Hope it helps...

    • Marked as answer by guaya81 Friday, July 13, 2018 9:42 PM
    Friday, July 13, 2018 9:38 PM
  • .theDBguy

    thanks and may I ask a question very dumb, what is the <> 00-caprock is this mean an exclusion

    thanks


    guaya81

    yes

    It means exclusion of an individual value. For multiple values you've to repeat the condition for each excluded value. A shorthand way is to use IN operator with a list as I suggested.


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    • Marked as answer by guaya81 Friday, July 13, 2018 10:11 PM
    Friday, July 13, 2018 9:57 PM

All replies

  • just include an additional exclusion condition

    like

    WHERE il.CustID like '00-CA%'
    AND il.CustID NOT IN ('00-CAPROCK','00-CAREDIRECT')


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    • Marked as answer by guaya81 Friday, July 13, 2018 9:42 PM
    Friday, July 13, 2018 9:35 PM
  • Hi,

    How about?

    ...WHERE il.CustID LIKE '00-CA%' AND il.CustID <> '00-CAPROCK' AND  il.CustID <> '00-CARDIRECT'

    Hope it helps...

    • Marked as answer by guaya81 Friday, July 13, 2018 9:42 PM
    Friday, July 13, 2018 9:38 PM
  • VISAKH16

    thank you very much are you a member or work for the page, because you always have the answer thank you and

    have a great weekend, will not try to bug you these next days.

    thanks again


    guaya81

    Friday, July 13, 2018 9:44 PM
  • .theDBguy

    thanks and may I ask a question very dumb, what is the <> 00-caprock is this mean an exclusion

    thanks


    guaya81

    Friday, July 13, 2018 9:45 PM
  • thanks and may I ask a question very dumb, what is the <> 00-caprock is this mean an exclusion


    The <> operator means "not equal to". It can also be written as !=, but <> is the preferred, as that is the ANSI standard for SQL.

    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Friday, July 13, 2018 9:57 PM
  • .theDBguy

    thanks and may I ask a question very dumb, what is the <> 00-caprock is this mean an exclusion

    thanks


    guaya81

    yes

    It means exclusion of an individual value. For multiple values you've to repeat the condition for each excluded value. A shorthand way is to use IN operator with a list as I suggested.


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    • Marked as answer by guaya81 Friday, July 13, 2018 10:11 PM
    Friday, July 13, 2018 9:57 PM
  • VISAKH16

    thank you very much are you a member or work for the page, because you always have the answer thank you and

    have a great weekend, will not try to bug you these next days.

    thanks again


    guaya81

    I'm also a member just like you :)

    You too have a great weekend!

    No worries... Always happy to help :)


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    Friday, July 13, 2018 9:58 PM