Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by exact match on string
Message
 
À
28/07/2011 10:20:14
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01519453
Message ID:
01519455
Vues:
26
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform