Forum Replies Created

Viewing 15 posts - 1,546 through 1,560 (of 4,086 total)

  • RE: Min not working for ROW_NUMBER

    nicolestrain07 - Friday, November 3, 2017 9:02 AM

    drew.allen - Friday, November 3, 2017 8:50 AM

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Min not working for ROW_NUMBER

    I think the error is in your logic, not in the functionality.  I'm not sure what you're expecting the MIN of the ROW_NUMBER to produce, but it will always be...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SQL Query (Merge Statement) Help

    MMartin1 - Friday, November 3, 2017 1:54 AM

    Use a CTE to filter your target table.

    Is the CTE able to make use...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Tie row to previous rows of data

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Combining data from 2 tables with mostly identical data

    sroth 71504 - Thursday, November 2, 2017 2:38 PM

    drew.allen - Thursday, November 2, 2017 1:51 PM

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Combining data from 2 tables with mostly identical data

    You don't want to do this - at least not this way.  You're trying to convert a denormalized table into a different kind of denormalized table.  What you need to...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Which is the end?

    hakan.winther - Thursday, November 2, 2017 7:19 AM

    One problem with EOMONTH is that it doesn't return the time, and if you convert...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Join two tables with complex derived keys that don't match

    aaron.reese - Thursday, November 2, 2017 4:33 AM

    Guys,

    I need to join two tables together - Master and Detail

    Master Table:
    ID...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: StartDate and EndDate in same column

    jcelko212 32090 - Tuesday, October 31, 2017 10:05 AM

    drew.allen - Tuesday, October 31, 2017 8:44 AM

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SQL Query (Merge Statement) Help

    Use a CTE to filter your target table.

    WITH Tgt AS (
        select T.*
        FROM @Targettable T
        INNER JOIN @FilterTable f on t.bid = f.id
        WHERE...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: StartDate and EndDate in same column

    Joe,

    First, don't you think it's time...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Sum case nulls and 1900-01-01 00:00:00.000

    ThomasRushton - Tuesday, October 31, 2017 5:02 AM

    Sounds like an ANSI_NULLS setting thing...  Some sample code:

    DECLARE @ClosedStuff TABLE...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Nearest Date value

    ansaryarshad - Tuesday, October 31, 2017 2:29 AM

    drew.allen - Monday, October 30, 2017 2:26 PM

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Nearest Date value

    pietlinden - Monday, October 30, 2017 11:07 AM

    here's one solution using LAG. Requires SQL Server 2012 and later.

    use tempdb;
    go

    create table...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Trying to avoid using CROSS JOIN

    The part in parentheses is just a Table Value Constructor and the v(TemplateName, Val) is just providing aliases for the fields returned by the Table Value Constructor.  The CROSS APPLY...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 1,546 through 1,560 (of 4,086 total)