Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Still Duplicate Entries...annoying.. :(

Author  Topic 

anmasula
Starting Member

1 Post

Posted - 2013-06-24 : 01:35:11
Below is the query Im Using,
select DISTINCT
RTRIM(LTRIM(V_Gs_Processor.Name0)),
Count(*) as 'Count'
From V_gs_processor
Group by Name0

But still Im getting duplicate entries... result is as below,
Intel(R) Pentium(R) 4 CPU 2.00GHz 3
Intel(R) Pentium(R) 4 CPU 2.40GHz 3
Intel(R) Pentium(R) 4 CPU 2.40GHz 6
Intel(R) Pentium(R) 4 CPU 2.80GHz 1
Intel(R) Pentium(R) 4 CPU 2.80GHz 17
Intel(R) Pentium(R) 4 CPU 3.00GHz 12
Intel(R) Pentium(R) 4 CPU 3.00GHz 101
Intel(R) Pentium(R) 4 CPU 3.20GHz 7
Intel(R) Pentium(R) 4 CPU 3.20GHz 124
Intel(R) Pentium(R) 4 CPU 3.40GHz 1
Intel(R) Pentium(R) D CPU 3.40GHz 3
Intel(R) Pentium(R) D CPU 3.40GHz 52

Can anybody help me please.... :)

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-24 : 01:41:36
[code]
select
RTRIM(LTRIM(V_Gs_Processor.Name0)),
Count(*) as 'Count'
From V_gs_processor
Group by RTRIM(LTRIM(V_Gs_Processor.Name0))
[/code]

Name0 value is still distinct which is why it gave you duplicates

you need to apply same expression on group by

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -