Forum Replies Created

Viewing 15 posts - 2,761 through 2,775 (of 4,087 total)

  • RE: To include above details in whre clause

    mbavabohrude (3/29/2016)


    Thanks for your reply . When i ran the query and checked

    1. Due to inner join that is made ,It check for only c1 . For sitenumber c1...

  • RE: Using JOINs with GROUP BYs

    T-SQL was designed to mirror English, so the order of processing does not match the written order. Queries are processed in the following order:

    FROM

    WHERE

    GROUP BY

    HAVING

    SELECT

    ORDER BY

    TOP/OFFSET-FETCH

    Each step produces a...

  • RE: Remove/Keep record based on group

    Lynn Pettis (3/28/2016)


    scottcabral (3/28/2016)


    works, thanks!

    It works as long as there aren't two rows of data for the same Download, AccountNum, RootPolicyNum where CurrentStatus = 'Renewed' for both.

    I think that can...

  • RE: Difference between Full Outer and Cross Join

    Hugo Kornelis (3/28/2016)


    (**) The "next" here refers to the logical processing order; the actual processing order chosen by the Query Optimizer can be different as long as the results are...

  • RE: To include above details in whre clause

    You can always use a CASE expression, but it sounds like you might have a LOT of cases, so a table value constructor might be a better approach. You...

  • RE: indexes-non clustered

    Hugo Kornelis (3/23/2016)


    criterium

    Completely off-topic, but criteria is from Greek, so it uses the Greek singular criterion rather than the Latinate singular criterium

    Drew

  • RE: Looping and scalar value

    I agree that there are cases where the order is important, but my point was that the number of cases is far smaller than most people think. Running aggregates...

  • RE: Looping and scalar value

    Eirikur Eiriksson (3/21/2016)


    kuopaz (3/21/2016)


    I see, thanks. As it's scanning the tally table row-by-row from start to the predicate value, the order of N may be important in some cases (not...

  • RE: Add two columns to make one total

    lkennedy76 (3/17/2016)


    Jeff Moden (3/16/2016)


    lkennedy76 (3/16/2016)


    After a long hard battle of 'I don't wanna', the temp table is the best option in this scenario.

    Thank everyone for all your replies. I am...

  • RE: Optimize SP

    You're using temp tables to store results that are only used once(#MinPeriod and #MaxPeriod). It is better to use a CTE or a derived table for single use temporary...

  • RE: Optimize SP

    When posting optimization questions, it really helps to provide the actual execution plan (or at least the estimated execution plan).

    That being said, the first thing I see is an overuse...

  • RE: Getting values which dont join

    Actually, the best approach is to CROSS JOIN your missing Jobs table with your status table and then LEFT JOIN to the job status table. That way you don't...

  • RE: Conditional column display

    This type of formatting is usually best left to the presentation layer, SSRS for example.

    The only way to do it in T-SQL is with dynamic SQL.

    If you tell us what...

  • RE: Understanding the OVER clause

    The range is actually much more flexible than stated. For example these are all valid ranges:

    BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING

    BETWEEN 10 PRECEDING AND 5 PRECEDING

    BETWEEN 1 FOLLOWING AND...

  • RE: Add two columns to make one total

    lkennedy76 (3/15/2016)


    I took out the ISNULL, the SUM function requires a group by so I grouped it by ID not the amounts, all amounts are now NULL

    As Gail already said,...

Viewing 15 posts - 2,761 through 2,775 (of 4,087 total)