You are here: Re: Unique ID added to a result set « MsSQL Server « IT news, forums, messages
Re: Unique ID added to a result set

Posted by David Portas on 10/01/82 11:28

Best would be to do it client side. The numbering implies some kind of
order but there is no ORDER BY clause in your example query. Here's an
example:

SELECT
(SELECT COUNT(*)
FROM pubs.dbo.authors
WHERE au_id <= A.au_id) AS row_num,
*
FROM pubs.dbo.authors AS A
ORDER BY au_id ;

--
David Portas
SQL Server MVP
--

 

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

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