Viewing 15 posts - 751 through 765 (of 1,923 total)
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...
May 27, 2011 at 8:32 am
Awesome.. happy to be of some help 🙂
May 26, 2011 at 3:45 pm
Yes you can;
something like
CountofRows = COUNT(*) OVER(PARTITION BY YourGroupingcolumn)
May 26, 2011 at 3:25 pm
Change the datatype of the column C in the table variable to VARCHAR(5)...
May 23, 2011 at 11:47 am
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?
May 23, 2011 at 11:15 am
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...
May 23, 2011 at 11:07 am
Will all A B combination have only 3 rows each ?
May 23, 2011 at 10:54 am
navireddy.g (5/23/2011)
I have some many records in the table,i have to get the above mentioned...
May 23, 2011 at 1:24 am
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...
May 21, 2011 at 9:09 am
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?
May 20, 2011 at 12:25 pm
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...
May 20, 2011 at 11:28 am
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...
May 20, 2011 at 12:58 am
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)
May 20, 2011 at 12:18 am
TroyG (5/19/2011)
May 20, 2011 at 12:01 am
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...
May 19, 2011 at 8:01 pm
Viewing 15 posts - 751 through 765 (of 1,923 total)