You are here: Re: SQL Distinct Value and Order by some Field...... « MsSQL Server « IT news, forums, messages
Re: SQL Distinct Value and Order by some Field......

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация