|
Posted by John Bell on 10/21/77 11:36
Hi
Posting DDL and sample data would help along with the output you require
from that data http://www.aspfaq.com/etiquette.asp?id=5006
If there are multiple B values for each A you will need some way of
distinguishing the one to use e.g.
SELECT A
FROM ( SELECT 1 AS A, 2 as B
UNION ALL SELECT 1, 3
UNION ALL SELECT 20, 3
UNION ALL SELECT 20, 4
UNION ALL SELECT 30, 1 ) AS Tbl
GROUP BY A
ORDER BY MIN(B)
John
"krishnan" <krishnanthangaraj@gmail.com> wrote in message
news:1136377816.031127.123840@g14g2000cwa.googlegroups.com...
> 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
>
Navigation:
[Reply to this message]
|