Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group by exact match on string
Message
 
To
28/07/2011 10:20:14
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01519453
Message ID:
01519455
Views:
25
>I want to find all rows representing records that have at least one exact match on a varchar(100) column
>
>I am current doing
>
>
>SELECT 
>        name
>       ,symbol
>      ,from_date
>      ,thru_date
>  FROM [iSource100].[dbo].[Symbology]
>  where exists ( select Name, COUNT(symbol) as cntsym from Symbology
>  where thru_date > GETDATE()
>  group by Name having COUNT(symbol) > 1 ) 
>  and thru_date > GETDATE()
>order by name
>
>
>but from the results I'm getting it appears a 'match' for grouping seems to be based on just the first three characters of the Name column.
>
>How can I tell it to group by the entire contents of Name being an exact match?
>
>TIA

Could you provide some example data and desired result from it?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform