checking 2 sql columns and displaying result in 1 column

  • that creates all of your counts. you will need to modify the queries to get your wheres back in since i saw you included only one OrderHeader_ID


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

  • ok, never seen that structure before haha..so would i just form the query around everything you pasted? and whats with the ";" at the beginning

  • ewhitaker (4/16/2012)


    ok, never seen that structure before haha..so would i just form the query around everything you pasted? and whats with the ";" at the beginning

    Read up on CTEs - they need to start with a semi-colon unless they are the first statement in a batch.


  • ah..ok..i will read up on it...thanks

  • AHHHHHHHHHHHHH ... was skeptical at first, but did what you said and it worked...made other adjustments ,,,but dude..seriously thanks..i just found out plan b today if it didnt..and you saved me a ridiculous amount of stupid work

  • Phil Parkin (4/16/2012)


    ewhitaker (4/16/2012)


    ok, never seen that structure before haha..so would i just form the query around everything you pasted? and whats with the ";" at the beginning

    Read up on CTEs - they need to start with a semi-colon unless they are the first statement in a batch.

    Actually the statement previous to the WITH (CTE) needs to be terminated with a semi-colon.

  • Actually the statement previous to the WITH (CTE) needs to be terminated with a semi-colon.

    Grrrr! Correct 🙂


  • Phil Parkin (4/16/2012)


    Actually the statement previous to the WITH (CTE) needs to be terminated with a semi-colon.

    Grrrr! Correct 🙂

    when posting code i always put the semi colon infront of the WITH if there is no other statement before it otherwise it terminates the line before it at the end of the line.


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

  • capn.hector (4/16/2012)


    Phil Parkin (4/16/2012)


    Actually the statement previous to the WITH (CTE) needs to be terminated with a semi-colon.

    Grrrr! Correct 🙂

    when posting code i always put the semi colon infront of the WITH if there is no other statement before it otherwise it terminates the line before it at the end of the line.

    All I am trying to point out is the the [;] doesn't go at the front of the CTE. The syntax for the CTE specifies that if the CTE (WITH) is not the first statement in a batch that the previous statement must be terminated by a [;]. How everyone actually does the code, I'm not going to argue with unless I happen to be the gatekeeper to the database through which the code must travel. then I will insist that the [;] terminate the previous statement, not preceed the WITH.

Viewing 9 posts - 16 through 24 (of 24 total)

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