Forum Replies Created

Viewing 15 posts - 751 through 765 (of 1,923 total)

  • RE: T-SQL help

    Lowell, actually, if u look at the new dataset the OP provided, there are dups.. so, a GROUP BY of managerID with COUNT > 1 wont work on dups..

    You...

  • RE: Question On RANKING Functions in SQL 2005

    Awesome.. happy to be of some help 🙂

  • RE: Question On RANKING Functions in SQL 2005

    Yes you can;

    something like

    CountofRows = COUNT(*) OVER(PARTITION BY YourGroupingcolumn)

  • RE: split 1 column into 3 columns:

    Change the datatype of the column C in the table variable to VARCHAR(5)...

  • RE: split 1 column into 3 columns:

    SQL_Nw (5/23/2011)


    No, it can change.

    thanks.

    So you will need, C1, c2, c3, c4, c5.... etc etc depending on the rows, right?

  • RE: split 1 column into 3 columns:

    For your sample data:

    declare @testtable table

    ( A int, B int, C time , D datetime)

    insert into @testtable values

    (1 , 61 , '1:00' ,'5/10/2011 2:00')

    ,(1 , 61 , '2:00', '5/10/2011...

  • RE: split 1 column into 3 columns:

    Will all A B combination have only 3 rows each ?

  • RE: getting previous month id

    navireddy.g (5/23/2011)


    How to get previous month id for an entry if present month id field is null?

    I have some many records in the table,i have to get the above mentioned...

  • RE: DELETE and LEFT JOIN

    Try this:

    DECLARE @Parent TABLE

    (

    ParentID INT

    )

    DECLARE @child TABLE

    (

    ChildID INT,

    ParentID INT

    )

    -- Inserting Sample Data

    INSERT INTO @Parent

    SELECT SPT.number AS ParentID

    FROM master.dbo.spt_values SPT

    WHERE SPT.number...

  • RE: Query Question

    mikes84 (5/20/2011)


    ColdCoffee, that helps very much. Thanks for taking the time to write that!

    You're welcome, Mike.. does that query fit your requirement? And were the comments enough and informative?

  • RE: Query Question

    As promised, here is the solution to it:

    ; WITH DistUserCnt AS

    (

    --== Get the distinct user count per department

    SELECT Department, COUNT(DISTINCT UserID) DistUsrCnt

    FROM Permissions

    GROUP BY Department

    )

    , BaseGrps AS

    (

    /*

    The GROUP BY...

  • RE: identity ??

    disha1 (5/20/2011)


    Hi ,

    Please help to know what is the limit of identity ....I ran this command and it worked but i dont know maximum limit

    create table testj(

    id int identity (1,500000000))

    I...

  • RE: Select Query "In" Syntax

    Why not use a JOIN ?

    If JOIN is a prohibited substance (:-D) , then u can use something like

    SELECT *

    FROM MainTable

    WHERE col1 in ( select col1 from SubTable)

  • RE: Grouping by Running Total

    TroyG (5/19/2011)


    thats awesome! I was trying to do recursion with the cte but my brain was just not kicking in and sorting it out for me. Thanks for that. This...

  • RE: Grouping by Running Total

    You may wonder where i got the ID column from. From the purpose of running totals, if adopting my code, it requires an unique ID to each row; thus, i...

Viewing 15 posts - 751 through 765 (of 1,923 total)