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 2000 Forums
 SQL Server Development (2000)
 Group by non case sensative?

Author  Topic 

jrockfl
Posting Yak Master

223 Posts

Posted - 2004-07-28 : 15:03:11
Gurus,
This query will return WEBSITE, WebSite How can I group these together?

Instead of returning this..
2 WEBSITE
4 Website

It would show this
6 WEBSITE

SELECT COUNT(Ord_No) AS OrderTotal, User_Def_Fld_5
FROM OEHDRHST_SQL
WHERE Ord_dt >= 20040701
AND Ord_Type = 'O'
GROUP BY User_Def_Fld_5

X002548
Not Just a Number

15586 Posts

Posted - 2004-07-28 : 15:22:14
My Server (ok, well one of them) is setup with the standard out of the box config, so it already does that...

but try:


USE Northwind
GO

CREATE TABLE myTable99(Col1 varchar(10))
GO

INSERT INTO myTable99(Col1)
SELECT 'WEBSITE' UNION ALL
SELECT 'WEBSITE' UNION ALL
SELECT 'WEBSITE' UNION ALL
SELECT 'WEBSITE' UNION ALL
SELECT 'website' UNION ALL
SELECT 'website'
GO

SELECT UPPER(Col1), COUNT(*) FROM myTable99 GROUP BY UPPER(Col1)
GO

DROP TABLE myTable99
GO





Brett

8-)
Go to Top of Page

jrockfl
Posting Yak Master

223 Posts

Posted - 2004-07-28 : 15:47:02
Perfect! Works. Thanks Guru!
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-07-29 : 09:04:02
quote:
Originally posted by jrockfl

Perfect! Works. Thanks Guru!



Understand that this will cause a scan of your table....

Guru? Well maybe a margarita guru....oh wait, that's something else...




Brett

8-)
Go to Top of Page
   

- Advertisement -