SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Clause Group By
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cms9651
Starting Member

28 Posts

Posted - 08/30/2013 :  09:58:38  Show Profile  Reply with Quote
Hi all, hope in your help.

I try this sql query:

SELECT
	[NAMES], [NUMBER]
FROM
	[CV].[dbo].[T40]
WHERE
	[NUMBER] = '44644'
GROUP BY
	[NAMES], [NUMBER];

the output is:

NAMES		NUMBER	
BENCORE S.R.L.	44644
BENCORES.R.L.   44644

I need instead this other output, can you help me?

NAMES		NUMBER	
BENCORE S.R.L.	44644

James K
Flowing Fount of Yak Knowledge

3323 Posts

Posted - 08/30/2013 :  13:14:28  Show Profile  Reply with Quote
SELECT
	MIN([NAMES]) AS [NAMES], [NUMBER]
FROM
	[CV].[dbo].[T40]
WHERE
	[NUMBER] = '44644'
GROUP BY
	[NUMBER];
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 08/31/2013 :  05:16:49  Show Profile  Reply with Quote
ideally you would like to do some kind of fuzzy grouping to get these similar names grouped together. If you want you can run a MDM type logic to create standardized value out of these duplicate pattern.
Taking MIN may not always give you result you're after as there may be completely different entities whom you may need to list out separately

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000