Forum Replies Created

Viewing 15 posts - 421 through 435 (of 2,452 total)

  • RE: What is the best way to SELECT SUM while using PARTITION BY and WHERE and GROUP BY?

    Firewolf (8/29/2016)


    ok...so those are results my code gives....well apart from "Jim"....not sure where he comes from cos he aint in your sample data :ermm:

    Yeah, let us pretend Jim doesn't exist.:-D

    so...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: What is the best way to SELECT SUM while using PARTITION BY and WHERE and GROUP BY?

    Firewolf (8/29/2016)


    J Livingston SQL (8/29/2016)


    Firewolf (8/29/2016)


    J Livingston SQL (8/29/2016)

    did you try the code I originally posted?

    I just did now - it works on the sample data, but it hadn't for...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: What is the best way to SELECT SUM while using PARTITION BY and WHERE and GROUP BY?

    Firewolf (8/29/2016)


    J Livingston SQL (8/29/2016)

    did you try the code I originally posted?

    I just did now - it works on the sample data, but it hadn't for the true data. ...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: What is the best way to SELECT SUM while using PARTITION BY and WHERE and GROUP BY?

    Firewolf (8/29/2016)


    J Livingston SQL (8/29/2016)


    please can you reconfirm the results you are expecting from the latest sample data

    I verified that this table matches the results from the SQL table code...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: What is the best way to SELECT SUM while using PARTITION BY and WHERE and GROUP BY?

    please can you reconfirm the results you are expecting from the latest sample data

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Views not changing when table changes

    theres some thoughts here

    https://coding.abel.nu/2013/01/avoid-broken-views-in-sql-server-with-schemabinding/

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: SQL help - how do we find that a particular string appears x times in a certain field

    mw112009 (8/25/2016)


    if object_id('tempdb..#t') is not null DROP TABLE #t;

    create table #t( str varchar(4000) );

    insert into #t(str) values ( 'fox' );

    insert into #t(str) values ( 'fox fox fox' );

    insert into #t(str)...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: SQL help - how do we find that a particular string appears x times in a certain field

    please provide table script and sample data that describes your problem.

    thanks

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Seconds to hours??

    this article by Jeff Moden may give you some ideas

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

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: CALCULATING DELAY SECONDS

    I asked a similar question on one of your earlier posts.....

    for example

    "ProgramFirstday" = 1

    "ContractDetailFirstDay" = 7

    how do you determine whether this is 6 day delay OR 1 day early?

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: query that returns seconds

    just a thought...but looking at this post and a previous post of yours........ we might be missing a few tricks to get you to your results, maybe...maybe not.

    Are you able...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: query that returns seconds

    TheSQLGuru (8/24/2016)


    Given that this is a free forum, I don't know that you will find anyone that will take the time to set up imports from a 5+MB excel spreadsheet...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: query that returns seconds

    can I please get some clarification.....for example

    in #updateprogramtables......"ProgramFirstDay" = Monday and "Programstarttime" = 05:00:00

    and

    in #updatecontractdetailtable .... "ContractdetailFirstDay" = Sunday and "Contractdetailstarttime" = 23:00:00

    what results are you expecting?

    eg...is this...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Insert changed data

    tt-615680 (8/24/2016)


    Dear all,

    I'm trying to find out the best why of inserting into a column e.g "ChangedData" if it has either been 'updated', 'deleted' or inserted.

    Thank you in advance!

    perhaps...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: SQL to sum last 12 month values from same table

    plenty of ideas and thoughts to be found here

    https://www.simple-talk.com/sql/t-sql-programming/calculating-values-within-a-rolling-window-in-transact-sql/

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

Viewing 15 posts - 421 through 435 (of 2,452 total)