none
EQUAL not EQUAL

    질문

  • 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

    2018년 7월 13일 금요일 오후 9:33

답변

  • 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

    • 답변으로 표시됨 guaya81 2018년 7월 13일 금요일 오후 9:42
    2018년 7월 13일 금요일 오후 9:35
  • Hi,

    How about?

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

    Hope it helps...

    • 답변으로 표시됨 guaya81 2018년 7월 13일 금요일 오후 9:42
    2018년 7월 13일 금요일 오후 9:38
  • .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

    • 답변으로 표시됨 guaya81 2018년 7월 13일 금요일 오후 10:11
    2018년 7월 13일 금요일 오후 9:57

모든 응답

  • 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

    • 답변으로 표시됨 guaya81 2018년 7월 13일 금요일 오후 9:42
    2018년 7월 13일 금요일 오후 9:35
  • Hi,

    How about?

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

    Hope it helps...

    • 답변으로 표시됨 guaya81 2018년 7월 13일 금요일 오후 9:42
    2018년 7월 13일 금요일 오후 9:38
  • 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

    2018년 7월 13일 금요일 오후 9:44
  • .theDBguy

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

    thanks


    guaya81

    2018년 7월 13일 금요일 오후 9:45
  • 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

    2018년 7월 13일 금요일 오후 9:57
  • .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

    • 답변으로 표시됨 guaya81 2018년 7월 13일 금요일 오후 10:11
    2018년 7월 13일 금요일 오후 9:57
  • 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

    2018년 7월 13일 금요일 오후 9:58