Forum Replies Created

Viewing 15 posts - 2,821 through 2,835 (of 10,144 total)

  • RE: Comparing data for a certain day of the week by month for every year

    If you can set up your sample dataset in a readily-consumable format, I'll see what I can do.

    Readily-consumable means a script which will run and populate the sample table with...

  • RE: Rank duplicates, but only rows involved in duplicates

    Try again:

    Like Jeff I set up a scaled-up dataset to test against but ran out of time over the weekend to post it up. After reading Jeff's post I've added...

  • RE: Rank duplicates, but only rows involved in duplicates

    There appears to be a severe problem with posting at present.

  • RE: Rank duplicates, but only rows involved in duplicates

    Like Jeff I set up a scaled-up dataset to test against but ran out of time over the weekend to post it up. After reading Jeff's post I've added the...

  • RE: Rank duplicates, but only rows involved in duplicates

    sqldriver (10/24/2014)


    ChrisM@home (10/24/2014)


    sqldriver (10/24/2014)


    ChrisM@Work (10/24/2014)


    -- Changes MERGE JOIN to NESTED LOOPS, loses sort required for ROW_NUMBER()

    Would you mind explaining some more about this part?

    Thanks

    Sure. Have a good look at the...

  • RE: Derived table query

    You're welcome:

    --------------------------------------------------------------------------------------

    -- Items

    --------------------------------------------------------------------------------------

    IF OBJECT_ID ('tempdb..#Items') IS NOT NULL DROP TABLE #Items

    SELECT DISTINCT

    ipcm.KeyDepot,

    KeyVendor,

    ipcm.KeyItem,

    StockingUnitofMeasure,

    LeadTime,

    LotSize,

    ipcm.MinimumBalance,

    ipcm.PurchasingBuyerCode

    ,CASE WHEN BuyerCodes.PrimaryCode IS NULL THEN 'No Buyer Code Linked' ELSE BuyerCodes.Description END AS...

  • RE: Derived table query

    So now you understand that if you were to include this date column in your result set, it would increase your output rowcount by quite a lot - which was...

  • RE: Derived table query

    Thanks.

    Here's that same query reduced even more so it's much easier to understand:

    --------------------------------------------------------------------------------------

    -- PlannedRequirement (cut down even more)

    --------------------------------------------------------------------------------------

    SELECT

    KeyDepot = fpo.KeyDepotPlannedOrder,

    fpo.KeyItem,

    MIN_keydate = MIN(fpo.KeyDatePlannedRelease),

    MAX_keydate = MAX(fpo.KeyDatePlannedRelease)

    FROM BI1_DW_Fact_FirmPlannedOrders...

  • RE: Derived table query

    Thanks. Can you check this one please? I'm interested in the row count compared with the original, and also the difference between the min and max dates. "The original" in...

  • RE: Derived table query

    frdrckmitchell7 (10/24/2014)


    dbo.BI1_view_Dim_ItemMaster IM = keyitem

    BI1_DW_Dim_CalendarDefinition = keydate

    Here's that query again as a reminder. I need to know which table the column "keyitem" comes from:

    /*

    dbo.BI1_view_Dim_ItemMaster IM = keyitem

    BI1_DW_Dim_CalendarDefinition = keydate

    */

    --------------------------------------------------------------------------------------

    --...

  • RE: Adding an 'ORDER BY' clause removes part of a list.

    Hi Ben

    ben.brugman (10/23/2014)


    First of all thanks,

    Now I see I did muck up a bit, the temp table ##WW should have been ordered, see the code below. Probably lost that part...

  • RE: Derived table query

    Which table contains column "keyitem" as referenced in the original query?

  • RE: Derived table query

    Can you describe the result set you get from this query please? I'm interested in the row count compared with the PlannedRequirement query (they should be the same), and any...

  • RE: Derived table query

    Excellent! Now we can work with a much smaller query than the original. You want to see keydate in the output of the PlannedRequirement query, correct?

  • RE: Derived table query

    Excellent. Next step, can you test this modification of your query please?

    --------------------------------------------------------------------------------------

    -- Items

    --------------------------------------------------------------------------------------

    IF OBJECT_ID ('tempdb..#Items') IS NOT NULL DROP TABLE #Items

    SELECT DISTINCT

    ipcm.KeyDepot,

    KeyVendor,

    ipcm.KeyItem,

    StockingUnitofMeasure,

    LeadTime,

    LotSize,

    ipcm.MinimumBalance,

    ipcm.PurchasingBuyerCode

    ,CASE WHEN BuyerCodes.PrimaryCode IS...

Viewing 15 posts - 2,821 through 2,835 (of 10,144 total)