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.
| Author |
Topic |
|
icx1983
Starting Member
1 Post |
Posted - 2002-05-30 : 05:40:50
|
| Hi folks,Bear with me -- there IS some hefty SQL questions coming up- just gonna set the background briefly first :)I use MS Proxy Server 2.0 to generate and output log files in an SQL 2000 database. That bit works great. Unfortunately, Proxy logs *everything* under a given url, for example, all the images loaded from one specific web site (eg. www.sqlteam.com) will produce separate records, such as:http://www.sqlteam.com/image1.gifhttp://www.sqlteam.com/images/image3.gif...So my question is, how do I select DISTINCT URL's from the list? I'm not interested in all the duplicates...I tried SELECT DISTINCT, but because the URLs I quoted above are distinct, it would list *all* of them. All I want to do is select the DISTINCT values of the first part of the field, i.e. http://www.sqlteam.comAny ideas?Many thanks! |
|
|
macka
Posting Yak Master
162 Posts |
Posted - 2002-05-30 : 06:18:31
|
| One way of doing this is to use the CHARINDEX function.This should allow for http:// and https:// in the log files.SELECT DISTINCT LEFT(url,CHARINDEX ('/',url + '/',CHARINDEX('://',url)+3)-1) FROM tblURLHTH,macka. |
 |
|
|
|
|
|
|
|