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)
 Selecting a Distinct with extras

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-04-25 : 22:14:28
Shaun writes "Hi,

I am using SQL Server 2k on a Win2k Server box (no service packs), and want to perform the following using TransactSQL (obviously).

I have a table with the following fields:

-ID (Unique)
-URL (eg http://blah.com) - Not unique.

I want to perform a select that returns three colums and works as follows:

Selects distinct on URL and returns the URL, 1 ID as an example (say Top 1) and a count of how many instances of each URL are in the database....

Can you help???

Cheers,

-Shaun"
   

- Advertisement -