Forum Replies Created

Viewing 15 posts - 196 through 210 (of 1,923 total)

  • RE: Filtering rows from one table.

    This?

    begin tran

    ; with cte as

    (

    select * , rn = ROW_NUMBER() over(PARTITION by DateValue ,Value order by DateValue) from #tableone

    )

    , DeleteCount AS

    (

    select DateValue...

  • RE: Need Help in T-sql

    Unnati,

    I have seen you on another thread and i remember asking you to provide DDL so that people can jump on the thread without wasting yours as well as...

  • RE: Determin previous, current, future fiscal years

    I am having hard time visualizing how your expected result looks like.. Can you proivde a visual example on how it should be?

  • RE: trimming a text string

    Polka, try this:

    declare @string varchar(200) = '\Beverages\Soda Pop\Mountain Dew'

    select @string = STUFF( @string , 1 , CHARINDEX('\',@string,CHARINDEX('\',@string)+1),'')

  • RE: pivot?

    If are you 100% sure that the values for name will alwys be 'joe' , 'bill' and 'rob' (i sense that this is sample data, and your original data will...

  • RE: Getting Last row in a partitioned list

    Given your explanation, do u want to see 2,'a' in your expected reslt?

  • RE: How to consolidate sequential detail rows into one summary row

    As sean, points out, without defining the order of the rows, it is impossible to group the "islands"

    To show u a sample of how it will work with the defined...

  • RE: Struggling with query. Number of times per group a record has value for certain field

    This?

    ; WITH sampledata(OrderNumber,OrderDetail,ItemCategory) AS

    (

    SELECT 1,1,'A'

    UNION ALL SELECT 1,2,'A'

    UNION ALL SELECT 1,3,'L'

    UNION ALL SELECT 2,1,'A'

    UNION ALL SELECT 3,1,'N'

    UNION ALL SELECT 3,2,'R'

    UNION ALL SELECT 3,3,'Y'

    ),

    GroupsWithA (OrderNumber ,ItemCategoryCt...

  • RE: Using group by

    Possible. here it is

    if OBJECT_ID('tempdb..#temp') is not null

    drop table #temp

    create table #temp (size int, nameofitem varchar(1) , price int)

    insert into #temp

    ...

  • RE: TOP 10 of each Division

    Cadavre (4/20/2012)


    I've been struggling to come up with any algorithms for a design issue this morning which is probably further proof of needing coffee.

    And its deep into the night, 2...

  • RE: TOP 10 of each Division

    Cadavre (4/20/2012)


    Vedran Kesegic (4/19/2012)


    Yes, but CTE bring limitations: it wont work in a view, and it works on less SQL versions that without CTE. So, my choice is to use...

  • RE: TOP 10 of each Division

    Vedran Kesegic (4/19/2012)


    Yes, but CTE bring limitations: it wont work in a view, and it works on less SQL versions that without CTE. So, my choice is to use a...

  • RE: TOP 10 of each Division

    Vedran Kesegic (4/19/2012)


    CTE is good solution for recursions and if you need same expression more than once, but this is not the case here.

    So, the same thing without CTE:

    SELECT it.*

    FROM

    (SELECT...

  • RE: Return items not modified in "X" days?

    Need more clarification 🙂

    SELECT DATEADD(MM,-12,GETDATE())

    give you 2011-04-19 11:12:01.653

    Now if you had a row with April 2011, should that be neglected or should that be included?

  • RE: Return items not modified in "X" days?

    12 months back, from today will include months in 2011 also. So you really cant base 12 months on the date column (which contains only years) with the data you...

Viewing 15 posts - 196 through 210 (of 1,923 total)