Forum Replies Created

Viewing 15 posts - 1,366 through 1,380 (of 2,452 total)

  • RE: Running total error

    try this....based on your sample data (I think)

    WITH rt_cte as (

    SELECT a.[WK NO],

    AC= MAX(AC),

    comp= MAX(COMP),

    AUSD= SUM(CASE WHEN SOA_TYPE = 'Agent' THEN USD_AMOUNT ELSE 0 END),

    FUSD= SUM(CASE WHEN SOA_TYPE...

  • RE: Help on PIVOT Query

    try this.....

    with cte as (

    SELECT ID

    , COUNT(*) AS cnt

    , MIN(orderdate) mind

    , MAX(orderdate) AS maxd

    FROM #TEMP

    GROUP BY ID)

    SELECT cte.ID

    , t2.Orderamt AS CurrentAmt

    , t1.Orderamt AS PreviousAmt

    FROM cte

    INNER JOIN #TEMP AS t1

    ON cte.ID...

  • RE: Help on PIVOT Query

    the following article may help you

    http://www.sqlservercentral.com/articles/T-SQL/63681/

  • RE: Optimize SQL

    based on Lynn's previous code...I think the performance can be improved ... comments in the code

    test script:...about 20secs and hopefully provides a test sample that imitates your real world

    IF...

  • RE: Optimize SQL

    Lynn Pettis (6/29/2014)


    How about giving this a shot. You may also be able to run this against all ID_Resource entities at once instead of one at a time.

    I'd try...

  • RE: Optimize SQL

    It is a bit more complicated because of the rules given by customers ..........

    I think it would help us if you could explain the "rules" of your "application management planning...

  • RE: Optimize SQL

    J Livingston SQL (6/24/2014)


    a.guillaume (6/23/2014)


    hi,

    To calculate the hours and lack of presence it takes 15 minutes

    can you share the code you are running that takes 15 minutes?,,...having a better insight...

  • RE: Optimize SQL

    a.guillaume (6/23/2014)


    hi,

    To calculate the hours and lack of presence it takes 15 minutes

    can you share the code you are running that takes 15 minutes?,,...having a better insight of what is...

  • RE: Optimize SQL

    a.guillaume (6/22/2014)


    Hi,

    ARNAUD should be approved absent from 12:00 p.m. to 1:00 p.m. (lunch?)

    but actually absent from 11:45 a.m. to 1:15 p.m.....

    so therefore he was AWOL(!) 11:45am to 12:00 pm and...

  • RE: Optimize SQL

    Jeff Moden (6/21/2014)


    a.guillaume (6/19/2014)


    ARNAUD is working the 06/19/2014

    He can't work on

    00-8:00

    12:00 p.m. to 1:00 p.m.

    10:00 p.m. to...

  • RE: Optimize SQL

    Currently we have calculations that work but take time: 15mn but it will take 1 hour at the end of the year ...

    had a longer look at this...but cant resolve...

  • RE: Optimize SQL

    can we assume that if [Resource_ABSENCE].[Id_Raison_absence] = 1 then the user is absent all day and therefore .... Théo minus absence = 0

  • RE: Optimize SQL

    a.guillaume (6/19/2014)


    Day NbMinTheo Théo minus absence

    2013-12-09 450 ...

  • RE: Optimize SQL

    a.guillaume (6/19/2014)


    this script contains one example

    Regards

    Arno

    thanks for the script...can you please confirm what results you are expecting from this data...just take a single day as an example

    thanks

  • RE: Optimize SQL

    can you please supply table create / sample data insert scripts and the expected results for the sample data.

    pls try and cover all eventualities .....eg do some people work overnight...

Viewing 15 posts - 1,366 through 1,380 (of 2,452 total)