Forum Replies Created

Viewing 15 posts - 2,716 through 2,730 (of 4,085 total)

  • RE: AVG Function not working as expected.

    Your data has a tab in it, so you are getting two rows: one with a tab, and one without. SQL will often ignore trailing spaces, but tabs are...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Use Different Group By and Order By Columns with Sub-query

    The GROUP BY clause creates a grouping set and you can only select or order by properties of the grouping set. A grouping set has two kinds of properties...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Max value in Case Statements

    Is there some reason that you chose to use CROSS APPLY rather than CROSS JOIN? I tend to only use CROSS APPLY if the right side is somehow dependent...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Need to find new vehicle service records for last six months

    Part of the problem is that you are accessing the VehicleMaintenance table SIX times when I think you can do what you need to by replacing your sub-queries with CASE...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Performance tuning a query

    Eirikur Eiriksson (4/18/2016)


    Why does the ActivitiesSamplesPartners join not have an ON clause or is it just bad code formatting?

    😎

    The tables are logically joined in the order of the ON clauses....

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Windowing functions vs Non-deterministic ROW-NUMBER()

    ROW_NUMBER() is deterministic as long as the ORDER BY clause is deterministic. This is why it's a good idea to add enough keys to the ORDER BY clause to...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Concatenate Grouped data with custom text for each value

    Depending on your indexes, the following may be better (and also produces the full concatenated string using the XML concatenation method).

    Create table #TestTable (EmailID Int, EmailAddress Varchar (100))

    Insert #TestTable Values...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Performance tuning a query

    Also, you can't just assume that the function is not the problem. Unless it's a inline table-valued function, it quite possibly is the problem and re-writing it to be...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How toGet column name with changing value in SQL-server

    You have several issues here.

    1) This requires an order and your data has no obvious way to specify that order.

    2) You are combining columns with different data types into a...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Reassign sequential group numbers to results of DENSE_RANK?

    Luis Cazares (4/14/2016)


    drew.allen (4/14/2016)


    You need to be VERY CAREFUL with the quirky update. It is undocumented, not guaranteed, and requires a clustered index on the sort order. If...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Can not get results to insert into table

    Jeffery Williams (4/14/2016)


    Yes INSERT INTO.

    I am getting an error that I need an output clause. Sorry, not sure where to put that or what syntax.

    Exact Error:

    Msg 10716, Level 15, State...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Reassign sequential group numbers to results of DENSE_RANK?

    You need to be VERY CAREFUL with the quirky update. It is undocumented, not guaranteed, and requires a clustered index on the sort order. If you DO have...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Reassign sequential group numbers to results of DENSE_RANK?

    Tables represent sets, which are inherently unordered. All of the rows that contain NULL values are indistinguishable from each other based solely on the data that you have provided,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Reassign sequential group numbers to results of DENSE_RANK?

    It's probably going to be much easier to work from the raw data rather than pre-processed data. Can you post samples from the original table and the original query?

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to collapse Matched Pairs into Groups?

    If I understand correctly, he is looking for complete subgraphs (or Cliques).

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 2,716 through 2,730 (of 4,085 total)