Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group by exact match on string
Message
From
28/07/2011 10:20:14
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Group by exact match on string
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01519453
Message ID:
01519453
Views:
77
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


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Next
Reply
Map
View

Click here to load this message in the networking platform