Beginner stuck again could use some help

  • Hello again, I have been stuck for 3 days trying to get this right but I just can't figure it out, if someone could help me I would be extremely grateful, this part of my assignment wants me to use a CTE and the AdventureWorks2012 DB. Here is my assignment question,

    Query the Purchasing.PurchaseOrderHeader Table to find all PurchaseOrderId's that Do NOT have the ShipMethods named ("OVERSEAS -DELUXE" or "OVERNIGHT J-FAST") use a Common Table Expression to join to a table that is generated by a subquery of the Purchasing.ShipMethod to accomplish this. Display the ShipMethodID and its Name.

    I know how to query the Purchasing.PurchaseOrderHeader table to find all PurchaseOrderID's that Do NOT have the ShipMethod names but I just can't figure out how the rest of the problem. This has given me headache after headache, if anyone can help please,

    -Tony C.

  • owninginc2k11 (10/10/2016)


    Hello again, I have been stuck for 3 days trying to get this right but I just can't figure it out, if someone could help me I would be extremely grateful, this part of my assignment wants me to use a CTE and the AdventureWorks2012 DB. Here is my assignment question,

    Query the Purchasing.PurchaseOrderHeader Table to find all PurchaseOrderId's that Do NOT have the ShipMethods named ("OVERSEAS -DELUXE" or "OVERNIGHT J-FAST") use a Common Table Expression to join to a table that is generated by a subquery of the Purchasing.ShipMethod to accomplish this. Display the ShipMethodID and its Name.

    I know how to query the Purchasing.PurchaseOrderHeader table to find all PurchaseOrderID's that Do NOT have the ShipMethod names but I just can't figure out how the rest of the problem. This has given me headache after headache, if anyone can help please,

    -Tony C.

    Sure. Show us what you have done so far to try and solve the problem.

  • Sounds like a goofy assignment... There's no logical reason to use a CTE for this request... It just creates code clutter...

    In any case it's simple enough to accomplish... but... like Lynn said, show what you've tried 1st.

  • To reiterate what everyone else is trying to tell you, we cannot help you unless you follow minimal forum rules and netiquette. We need to see DDL. This DDL should include keys (you do know the table has to have a key, do not you?), Constraints, DRI actions and all that stuff.

    If you are working in a shop where people give you specs like this to program from, it is time to update your resume and leave your employer is both stupid and rude. He expect you to read his mind, which is clearly impossible.

    I hope you understand about weak and strong entities and actually have a valid data model. Also, why do not you show us what you have tried instead of giving us a vague useless narrative? You did try something did you not? 😉

    Books in Celko Series for Morgan-Kaufmann Publishing
    Analytics and OLAP in SQL
    Data and Databases: Concepts in Practice
    Data, Measurements and Standards in SQL
    SQL for Smarties
    SQL Programming Style
    SQL Puzzles and Answers
    Thinking in Sets
    Trees and Hierarchies in SQL

Viewing 4 posts - 1 through 3 (of 3 total)

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