You are here: Re: SQL Union Problems When Trying to Retrieve Random Records « MsSQL Server « IT news, forums, messages
Re: SQL Union Problems When Trying to Retrieve Random Records

Posted by Helmut Woess on 10/02/29 11:50

Am 6 Jun 2006 08:02:01 -0700 schrieb Jeremy:
....
> I have also tried the following which does not provide an error but i
> cannot find a way only to return one record from the second query

Without looking at the rest of your query only a hint for getting only one
record (works only for SQL2000 and higher):

select col1, col2, ... from table where ...
union
select * from
(select top 1 col1, col2, col3, ... from table where .... order by col1,
....) as X

.... and you get only the first record from the second part.

bye, Helmut

 

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

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