Re: SQL Distinct Value and Order by some Field......

From: Murdoc <murdoc_0_at_hotmail.com>
Date: Thu, 5 Jan 2006 11:59:43 +0000 (UTC)
Message-ID: <xn0egvtte6rx8d000_at_news-south.connect.com.au>


krishnan wrote:

> Dear all,
>
> In SQL Server 2000 , how to get distinct records sort by one
> field .
>
> Example
>
> SELECT DISTINCT A FROM tblTEST ORBER BY B
>
> Here, In Table
>
> Field 'A' contain more than one same data...
> Field 'B' contain all are different Data......
>
> I want distince in Field 'A' and order by Field 'B'..... how to get
> it.........
>
> regards
> krishnan

Since the ORDER BY clause of the query is done AFTER the SELECT clause, it does not make sense to perform this query. There will be multiple values of 'B' for a given value of 'A' (multiple records, of course).

What situation are you trying to use this query for?

-- 
Received on Thu Jan 05 2006 - 12:59:43 CET

Original text of this message