Forum Replies Created

Viewing 15 posts - 676 through 690 (of 3,544 total)

  • RE: Are the posted questions getting worse?

    Sean Lange (6/16/2014)


    ...a few technological advances (like goal line technology).

    Except that in one match already, with two different views of the goal line, one clearly showed no goal the...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Are the posted questions getting worse?

    Stefan Krzywicki (6/6/2014)


    I don't know who to contact since Steve is on vacation, but I got the daily newsletter this morning and clicked on the link for "Is Powershell Worth...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Update status flag based on max created date or modified date

    WITH cte (locationid,flag,RID) AS (

    SELECT locationid,flag,ROW_NUMBER() OVER (

    PARTITION BY locationid

    ORDER BY ISNULL(createddate,modifieddate) DESC)

    FROM #templocationhistory)

    UPDATE l

    SET l.maintainancefalg = ISNULL(CAST(cte.flag as varchar(1)),'')

    FROM #templocation l

    LEFT JOIN cte ON cte.locationid = l.locationid AND...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Getting first and last value for every group.

    Michael Meierruth (6/3/2014)


    zafarthesultan (6/2/2014)


    The problem with my data is it comes as a result of a lot of calculation in a stored procedure. In the end there is only one...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: BULK INSERT with multiple character ROWTERMINATOR split in source

    The only way I can think of to process data with split row delimiter is to BULK load the data as CLOB using OPENROWSET and then parsing the data.

    Without knowing...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Getting first and last value for every group.

    If you want your results based on insert order and you add IDENTITY column you would end up with something like this

    CREATE TABLE #sampledata

    (

    RowID int IDENTITY(1,1),

    userId int,

    BaseYear int,

    TotalSales float

    )

    INSERT...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Getting first and last value for every group.

    Sean Lange (5/30/2014)


    I felt it important to state though in case others wander in here someday. 😀

    And quite right too! 🙂

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Getting first and last value for every group.

    Luis Cazares (5/30/2014)


    Note that your sample data didn't gave the exact results because you used UNION instead of UNION ALL, so you were losing duplicates. You should know as well...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Getting first and last value for every group.

    Sean Lange (5/30/2014)


    David Burrows (5/30/2014)[hrthe table is a heap and therefore has no order.

    Tables have no order if it is a heap or not. A clustered index does not provide...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Getting first and last value for every group.

    Your results indicate that you want first and last by insert order. the table is a heap and therefore has no order.

    You will need to add an IDENTITY column...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: sql qurery

    Because you are creating dynamic sql (why in this case with a fixed name?) you need to add extra quotes to get quotes in the query, like this

    SET @temp_xml1 =...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Sum a Column by Client and Group by date 4 weeks apart!

    Tallboy (5/28/2014)


    In a perfect world they will but in reality users a rushing and type a slightly different date, so I would prefer a kind if catch all between 2...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Sum a Column by Client and Group by date 4 weeks apart!

    SELECTt1.StaffID,

    SUM(t2.ALHours) AS [ALHours],

    SUM(t3.SLHours) AS [SLHours]

    FROMtable1 t1

    LEFT JOIN table2 t2

    ON t2.StaffID = t1.StaffID

    AND t2.WeekendingDate = t1.WeekendingDate

    LEFT JOIN table3 t2

    ON t3.StaffID = t1.StaffID

    AND t3.WeekendingDate = t1.WeekendingDate

    WHEREt1.StaffID = @StaffID

    ANDt1.WeekendingDate...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Sum a Column by Client and Group by date 4 weeks apart!

    Tallboy (5/27/2014)


    What I want out is three columns as follows;

    customerID , Max(4WeekEndDate), Sum(WorkedHours)

    123456 , 30/1/14 ...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Sum a Column by Client and Group by date 4 weeks apart!

    ;WITH cte (CustomerID,WeekEndingDate,WorkedHours,WeekNo) AS (

    SELECT CustomerID,WeekEndingDate,WorkedHours,CEILING(ROW_NUMBER() OVER (PARTITION BY CustomerID ORDER BY WeekEndingDate) / 4.0)

    FROM )

    SELECT CustomerID,MAX(WeekEndingDate),SUM(WorkedHours)

    FROM cte

    GROUP BY CustomerID,WeekNo

    ORDER BY CustomerID ASC,2 ASC

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 676 through 690 (of 3,544 total)