Forum Replies Created

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

  • RE: Insert into new table based on conditions

    Hi ChrisM@Work,

    This works very well. Thank you very much!

    Greetz,

    Geert

  • RE: Calculate time difference between multiple rows

    Hi Jason-299789,

    Sorry for the late reply. I had to do another project in between and this had to wait.

    But, thank you very much for your answer.

    It works the way I...

  • RE: Grouping records by time interval

    ChrisM@Work (3/6/2013)


    There's no data in the table for February 😛

    -- last month:

    SELECT

    MonthStart = DATEADD(month,DATEDIFF(month,0,getdate())-1,0), -- 1st Feb

    MonthEnd = DATEADD(month,DATEDIFF(month,0,getdate()),0) -- 1st Mar

    -- month before last:

    SELECT

    MonthStart = DATEADD(month,DATEDIFF(month,0,getdate())-2,0),...

  • RE: Grouping records by time interval

    ChrisM@Work (3/6/2013)


    I've no idea, Geert. Folks here on SSC will help you with coding decisions; this is more of a business decision. A date filter seems sensible to me but...

  • RE: Grouping records by time interval

    ChrisM@Work (3/6/2013)


    I meant in terms of potentially reducing the rowcount.

    Let's call a set from this table containing the same day, all of the intervals, and the same Event_Channel, a...

  • RE: Grouping records by time interval

    ChrisM@Work (3/6/2013)


    This data set obviously isn't what you were expecting to see, even though it exactly meets your requirements. What would you like to do with it?

    I have to update...

  • RE: Grouping records by time interval

    ChrisM@Work (3/6/2013)


    There's an error in the ddl for the interval table - check the PK.

    When providing a script for loading data, always check it first. I know from experience that...

  • RE: Grouping records by time interval

    Hi all,

    I adjusted the TestTables file. I included the complete Tussen_Tickets data which is actualy in our table. And I adjusted some other things.

    Hope this helps.

    You will find it in...

  • RE: Grouping records by time interval

    ChrisM@Work (3/4/2013)


    With the added cost of Event_Channel in the matrix table correlating with the inner query, it may be worthwhile splitting the query up, like this:

    SELECT *

    INTO #Matrix

    FROM Tijdsintervallen...

  • RE: Grouping records by time interval

    Hi,

    I connect to version: Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) Apr 2 2010 15:48:46 Copyright (c) Microsoft Corporation Standard Edition (64-bit)...

  • RE: Grouping records by time interval

    I'm connecting to SQL Server 2008 R2.

  • RE: Grouping records by time interval

    Hi ChrisM@Work,

    Yes, event_channel has to be populated, even if there isn't a match in the Tussen_Ticket table. This is because I have to update the results into another table in...

  • RE: Grouping records by time interval

    Hi ChrisM@Work,

    Thank you for your reply. In attachment you will find the executionplan. The Tussen_Tickets table has at this moment 31779 records.

    The query is almost correct. I only had to...

  • RE: Grouping records by time interval

    Hi ChrisM@Work,

    Thank you for your query and help. But this query needed 13 minutes to run. That's quiet long. How can the performance be improved?

    Greetz,

    Geert

  • RE: Grouping records by time interval

    Hi Cadavre,

    I attached a file with a script for result table as I would like to have it.

    The results table is based on the script attached before for the date...

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