Forum Replies Created

Viewing 15 posts - 46 through 60 (of 187 total)

  • RE: Calculating Profiles of Data

    arun.sas (9/28/2009)


    select id, item, f_year,

    sum(case when f_month = 01 then qty else 0 end)/sum(qty)*100 as 'P1',

    ...

  • RE: How to return a certain percentage of rows (NOT TOP PERCENT QUESTION)

    Ok, I have had a chance to test out your solutions and am glad to say that after a bit of fiddling it is returning the data I need! We...

  • RE: How to return a certain percentage of rows (NOT TOP PERCENT QUESTION)

    Thanks all, I'm out of the office so I'll test your solutions tomorrow.

    Just to clarify, what I wanted was to first order the rows in the temp table by number...

  • RE: Incorrect Sorting

    Allister Reid (6/9/2009)


    No bother, btw I really like this solution for finding the median, pretty neat. Will have a play around with large result sets when I get a...

  • RE: Incorrect Sorting

    Perfect! Thanks Allister, that works.

  • RE: Incorrect Sorting

    To find the median of a result set you have to first order the result set and then depending on the number of items in the set either return the...

  • RE: Incorrect Sorting

    Sorry, here's the full code:

    use tempdb

    go

    create table Test (Product nchar(20), Actual_Rate decimal(14,2), Quantity int)

    insert into dbo.Test

    select 'A-1015-7658',35.95,1

    union all

    select 'A-1015-7658',35.95,1

    union all

    select 'A-1015-7658',120.19,3

    union all

    select 'A-1015-7658',80.13,2

    union all

    select 'A-1015-7658',45.39,1

    union all

    select 'A-1015-7658',45.39,1

    ;with MedianTest as

    (

    select Product,

    ...

  • RE: Condense Two Rows into One

    Florian Reischl (4/3/2009)


    Hi David

    This is quiet similar to another post:

    http://www.sqlservercentral.com/Forums/Topic686470-338-1.aspx

    There you can also find a very good solution from Bob Hovious.

    Greets

    Flo

    Flo, I managed to do it by following Bob's method!...

  • RE: Condense Two Rows into One

    Linda hammell (4/6/2009)


    Just wanted to let you know that after a bit of fighting with it, I was successful in using a UDF to put the data in the format...

  • RE: Condense Two Rows into One

    All,

    Thanks for your input, I'll test out all of the suggestions and get back to you but it may take a little time!

  • RE: Read From XML Source into Variables

    Hi Ramesh,

    No, my XML Source is reading data from an Excel file that is in XML format and there are values from the Excel output that I want to store...

  • RE: Condense Two Rows into One

    Hi Ramesh,

    Slightly different question this time. Using the following:

    CREATE TABLE [dbo].[Test](

    [name] [varchar](10) NOT NULL,

    [jan] [int] NOT NULL,

    [feb] [int] NOT NULL,

    [mar] [int] NOT NULL,

    [year] [int] NOT NULL)

    INSERT INTO [dbo].[Test] (name, jan,...

  • RE: Condense Two Rows into One

    Thanks for your help Ramesh

  • RE: Condense Two Rows into One

    Thanks Guys but I'm still stuck! Here's a bit more info, firstly I've created a view that PIVOTs the data:

    CREATE VIEW PivotData

    AS

    SELECT id, description, [JAN], [FEB], [MAR], header

    FROM dbo.ForecastPartsD

    PIVOT (SUM(units)...

  • RE: Format of Value

    Thanks both for the quick response, your answers were exactly what I was looking for!

Viewing 15 posts - 46 through 60 (of 187 total)