Cross Apply

  • HappyGeek

    SSCoach

    Points: 18678

    Comments posted to this topic are about the item Cross Apply

    ...

  • Bob JH Cullen

    SSCrazy

    Points: 2082

    I don't think any of the answers are correct because the question refers to Products, and there is no mention of products in the query, only sales order values. Without knowing what was ordered, the query cannot return anything related to product.

    Another badly worded question, I'm afraid.

  • BillLudlow

    SSCertifiable

    Points: 6538

    I also didn't think any of the answers were correct as the order by was by CustomerId then TotalDue desc

  • Koen Verbeeck

    SSC Guru

    Points: 258965

    Nice but somewhat confusing question.

    SalesOrderID <> Product.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Koen Verbeeck

    SSC Guru

    Points: 258965

    BillLudlow (10/15/2015)


    I also didn't think any of the answers were correct as the order by was by CustomerId then TotalDue desc

    Yes, but since CustomerID is filtered upon there is only one value, so it doesn't matter.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Toreador

    SSChampion

    Points: 11253

    The correct answer is that an error occurs, as neither of those tables exists 😉

  • Koen Verbeeck

    SSC Guru

    Points: 258965

    Toreador (10/15/2015)


    The correct answer is that an error occurs, as neither of those tables exists 😉

    The more correct answer would then be: "It depends". 😛

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • tripleAxe

    SSCertifiable

    Points: 5604

    None of the columns returned by the query would represent a product.

  • Ed Wagner

    SSC Guru

    Points: 286980

    I think the intent of what the question is trying to teach is good, but the answers are worded strangely. None of them accurately define the result set, so I just picked the closest one I couldn't say is flat-out wrong.

  • HappyGeek

    SSCoach

    Points: 18678

    OK OK, I think I got it, it was my first question and it was badly worded, many apologies for that.

    I made the mistake of changing the SQL statement to look less complex in order to demo what can be done with TOP, Only sorry I forgot to amend the possible answers accordingly :blush:

    Thanks Ed, the intent was to show how a correlated query can be helpful in such a situation. I could also have given the name of the version of AdventureWorks I used to check the output.

    🙁

    ...

  • michal.lisinski

    SSCertifiable

    Points: 6933

    Nice but Imho answer should be "The TOP 3 highest orders for all customers who have made a purchase."

    Regards

    Mike

  • Ed Wagner

    SSC Guru

    Points: 286980

    happygeek (10/15/2015)


    OK OK, I think I got it, it was my first question and it was badly worded, many apologies for that.

    I made the mistake of changing the SQL statement to look less complex in order to demo what can be done with TOP, Only sorry I forgot to amend the possible answers accordingly :blush:

    Thanks Ed, the intent was to show how a correlated query can be helpful in such a situation. I could also have given the name of the version of AdventureWorks I used to check the output.

    🙁

    I think most people would recognize it as being for AdventureWorks, but I would hope that it isn't necessary. I hope the QOTD is to learn something, so looking at the query and thinking it through is better that simply copy/paste/run then click/click to get the right answer.

    Like I said, I think your intent was good. I've submitted exactly zero QOTDs myself, but I think unarguable to say that with any question, different people are going to real the same question differently. You won't make everyone happy all the time.

  • g.britton

    SSChampion

    Points: 13689

    The supposedly correct answer "The TOP 3 selling products for all customers who have made a purchase." is ambiguous. As I read it, I would expect only three rows in the result set. While that is possible, it is not likely. I think the author meant:

    The TOP 3 selling products for each customer who have made a purchase.

    Gerald Britton, MCSE-DP, MVPToronto PASS Chapter[/url]

  • Koen Verbeeck

    SSC Guru

    Points: 258965

    happygeek (10/15/2015)


    OK OK, I think I got it, it was my first question and it was badly worded, many apologies for that.

    I made the mistake of changing the SQL statement to look less complex in order to demo what can be done with TOP, Only sorry I forgot to amend the possible answers accordingly :blush:

    Thanks Ed, the intent was to show how a correlated query can be helpful in such a situation. I could also have given the name of the version of AdventureWorks I used to check the output.

    🙁

    Congrats on your first QotD! The intent of this question was very good, so I hope this doesn't stop you from creating more questions.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Alvin Ramard

    SSC-Forever

    Points: 41190

    The query does not return product information therefore all answers are WRONG! Salesorderid does not equal product!

    Really need to stop posting questions where the wording is incorrect!!



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

Viewing 15 posts - 1 through 15 (of 33 total)

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