Viewing 15 posts - 811 through 825 (of 1,082 total)
HI All,
Wow this has been fun:
I have tested all the solutions with 1Mil rows of Jack's Data and here is what happened:
[Code]
DECLARE @customers TABLE(AccountNum INT, DM_Source_Id INT, Address VARCHAR(10))
DECLARE @i...
July 22, 2008 at 8:06 am
HI Jeff,
I think I might have found another solumtion
[Code]
;WITH MyCTE AS
(
SELECT
RANK() OVER (PARTITION BY [AccountNum] ORDER BY COUNT([Address]) DESC)
+ ROW_NUMBER() OVER (PARTITION BY...
July 22, 2008 at 7:32 am
HI Ryan,
That won't work as it will only return the 1 row.
July 22, 2008 at 3:50 am
HI Jeff,
I think he doesn't mind which is returned if they are all different.
I added an extra ordering to my rank query so that the first is returned but that...
July 22, 2008 at 2:25 am
Thanks Jack,
I also did some testing on the data with 5mil rows and the rank seems to be slightly fast (6secs).
With small datasets of 100-1000's the times are pretty much...
July 21, 2008 at 10:30 am
HI Jack,
Nice solution.
Is there a big performance difference between mine using a Rank and yours using a Row_number?
Thanks
Chris
July 21, 2008 at 10:06 am
You may also want to add this to the order by in the OVER clause
[DM_Source_Id],[Address] Instead of juts address.
That way if they all the different, you will get the one...
July 21, 2008 at 10:01 am
Ok I thought I might have a look at this with my own data.
Would this work for you?
SELECT DISTINCT [AccountNum],[Address]
FROM
(SELECT
RANK() OVER (PARTITION BY [AccountNum] ORDER BY [Address]) as...
July 21, 2008 at 9:58 am
b_boy (7/21/2008)
Somehow it didnt return any records, but I used the following code:
WHERET_OrderHeader.OrderDate >= DATEADD(day, DATEDIFF(day, 0, DATEADD(day, -7,
GETDATE())), 0)
AND T_OrderHeader.OrderDate < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)
it returned records,...
July 21, 2008 at 9:17 am
Hi all,
WEll the results above are not 100% as I had the query plan that skewed my numbers.
Here is what I have now.
With View:
CPU Time:16
Elapsed Time:16
Logical Reads:451
Scan Count:2
Without View:
CPU Time:16
Elapsed...
July 15, 2008 at 3:15 am
HI All,
Did some testing.
Join on View:
CPU time: 15Elapsed Time 27
Logical Reads 453 (from on 6 tables)
Join on Extracted Logic:
CPU time: 16 Elapsed Time 312
Logical Reads 457(from on 10 tables)
The logical...
July 15, 2008 at 2:50 am
One last thing this can be run as a block and will work , it should not have to be in a Procedure...
July 11, 2008 at 10:45 am
sorry one more question might be a silly one.
What console are you using?
e.g. SSMS or Query Analyser etc?
Thanks
July 11, 2008 at 10:42 am
Viewing 15 posts - 811 through 825 (of 1,082 total)