Forum Replies Created

Viewing 15 posts - 3,031 through 3,045 (of 4,085 total)

  • RE: Data comes correct with Select but when convert it to update, it does not work

    Shadab Shah (6/11/2015)


    Alvin Ramard (6/10/2015)


    If #Temp2 had a RowNumber column, with values that reset to 1 for each grouping, then in your update statement, you can add the join on...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Group by issue

    karen.blake (6/10/2015)


    When I added with rollup to the end of the group by piece, it listed some columns as having null values, some had a month in the month column,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Data comes correct with Select but when convert it to update, it does not work

    ChrisM@Work (6/10/2015)


    Your syntax is a little out:

    ;WITH CTE AS(

    SELECT ROW_NUMBER() OVER(PARTITION BY Id ORDER BY ID ASC) AS RowNum ,*

    FROM #TEMP

    )

    UPDATE #TEMP2 CTE

    SET SearchedBy =CASEWHEN RowNum=1 THEN CREATEDBY

    WHEN RowNum >...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Help needed in combining result

    KGJ-Dev (6/9/2015)


    Hi Drew/Sumngson,

    thanks for your response. once condition is missed on your query. If the offer is not available at company level then we need to check on client level...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Data comes correct with Select but when convert it to update, it does not work

    There are three main issues here:

    1) You have no join clause in your query, so you are essentially doing a CROSS JOIN.

    2) Neither table has a primary key, so you...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Help needed in combining result

    I added some functionality that you didn't ask for. I assumed that your table may have multiple offers for each company including future and multiple expired offers. I set it...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Eliminate Duplicate Rows when joining multiple tables

    tstagliano (6/9/2015)


    thanks for the syntax, but when I run this in our environment, I still have the sales amount repeated for all the months where there is revenue.

    You've probably set...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Eliminate Duplicate Rows when joining multiple tables

    I greatly simplified your query by doing the aggregates as soon as I had all the necessary information. It turns out that the tblProjectRevenue contained enough information to do...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Eliminate Duplicate Rows when joining multiple tables

    I don't see the sale date field and I'm assuming that you want to show the sale information in the fiscal period where the sale occurred. I'm only including...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Case statement in the Where clause

    In some languages, CASE statements can return a BOOLEAN, but not in SQL. You're probably trying to return a BOOLEAN value from the CASE statement. Try the following instead:

    /*

    ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to Split a string into two columns

    This solution works for the supplied data, but I don't guarantee that it will work for all cases.

    I've assumed that you will create a table containing relationship words that will...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: need to find the trend how employee makes sales every month

    You can actually do this without the self join. Since you haven't provided sample data, I can't readily do a performance comparison.

    ;WITH SalesOrderHeader As

    (

    SELECT H.SALESPERSONID,

    MONTH(H.SHIPDATE) AS SALES_MONTH,

    YEAR(H.SHIPDATE)...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: ETL question: which option is better for performance

    dbodell (6/5/2015)


    My real question is whether using EXCEPT adds significant overhead to the process. Everything we do in SQL is a balancing act between performance/efficiency and getting the job done....

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: ETL question: which option is better for performance

    Alvin Ramard (6/3/2015)


    Can't you use a WHERE clause for the UPDATE to only update the rows that need updating, without going the EXCEPT route?

    Generally when you are doing these kinds...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Declared Hard coded Variables

    You should not be using the arithmetic subtraction operator to calculate differences between date or time expressions. Subtract will only work with the old DATETIME and SMALLDATETIME data types....

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,031 through 3,045 (of 4,085 total)