Forum Replies Created

Viewing 15 posts - 406 through 420 (of 2,452 total)

  • RE: Year to date with Year and Week

    spin (9/5/2016)


    what i'm trying to do is a year on year comparison

    so the first thing i did was to create 2 data sets, one for current year - week and...

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

  • RE: Year to date with Year and Week

    spin (9/5/2016)


    Hi

    I have a bit of a conundrum

    I have a table which i've aggregated to :

    Year, Week, Customer, Product, Quantity CY, Value CY, Quantity PY, Value PY

    CY = current year,...

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

  • RE: SQL Union all & Group by clause not working

    John Mitchell-245523 (9/5/2016)


    I think unless you change the design of your database, this is always going to be a bit flaky.

    John

    possiblly this is data that has already been "pivoted"...if...

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

  • RE: Sum Time in Sql

    Eirikur Eiriksson (9/4/2016)


    This code will return the interval in the format of DD:HH:MM:SS

    😎

    USE TEEST;

    GO

    SET NOCOUNT ON;

    ;WITH DEMO(ID,FromTime,ToTime) AS

    (

    SELECT

    ...

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

  • RE: Get Table Data - Historical Table

    I've tried to use min/max in the select query using group by. But it didn't work

    please post code that didnt work......min/max with group by does work

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

  • RE: Sum Time in Sql

    do you have time differences of greater than 24 hours?

    eg

    ;WITH DEMO(ID,FromTime,ToTime) AS

    (

    SELECT

    ID

    ...

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

  • RE: Indexed Views and Reporting

    TheSQLGuru (9/2/2016)


    1) If you put indexed views on top of an OLTP database you can DESTROY that application's performance and concurrency!! And by destroy I mean make absolutely unusable.

    2) There...

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

  • RE: Set based solution for Geographic problem

    Steven.Grzybowski (9/2/2016)


    I have two sets of data that have geographic data associated with them. One is a set of customers, one is a set of stores. The Idea...

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

  • RE: Difference Between source OrderItems And ReturnOrderItems

    sm_iransoftware (9/1/2016)


    Hi Oldhands

    Thanks alot "J Livingston SQL"

    You wrote smart query . But I need this result. It means I need All orderitem records with their final status :

    Like this...

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

  • RE: Summing records in one column in two ways by value in another column to get proportion

    am I being a bit stupid here....but given the following I get the same results for each city ???

    shouldnt it

    London 0.75

    Madrid 0.25

    Declare @t table(City varchar(6),YearMonth varchar(7),Gender varchar(7), Records int)

    insert...

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

  • RE: How to fine tune cursor by rewrote the code

    can you please provide create table script and insert data script and your expected results based on your sample data.....as per earlier requests.

    you will find you will get better and...

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

  • RE: How to fine tune cursor by rewrote the code

    is this

    #test_account

    AcctNum|Payment|Adjustments|AdjSurcharges|Aj_Tax|TrxCharges|TrxSurcharges|TrxThirdPartyCharges|TrxTax|LateFee|PreviousBalance

    43913440.000.000.000.00523.4013.520.000.000.000.00

    43410130.000.000.000.00379.7311.340.0034.470.000.00

    43643990.000.000.000.00648.7918.3018.750.000.00263.73

    CurrentBalance|Balance1|Balance2|Balance3|Balance4|Balance5|TransCount|LastAdjDate|LastTrxDate

    536.920.000.000.000010900:00.035:57.2

    425.540.000.000.00008100:00.042:06.8

    685.84123.48140.250.00004900:00.054:18.7

    one table or two tables?

    suggest you read this article https://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/ and repost with some usable scripts

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

  • RE: Difference Between source OrderItems And ReturnOrderItems

    maybe something to build on ??

    SELECT Id

    FROM Table_Order

    EXCEPT

    (

    SELECT OrderId

    FROM Table_ReturnORD

    );

    SELECT O.Id,

    OI.ItemId,

    ...

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

  • RE: Difference Between source OrderItems And ReturnOrderItems

    the ItemId's in the Orders/returns tables are entirely different...is this a typo?

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

  • RE: Calculating diffrence in minutes using datetiff function

    edit deleted...not a good solution sorry !

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

Viewing 15 posts - 406 through 420 (of 2,452 total)