You are here: Re: 10 Random records, 1 from each category « MsSQL Server « IT news, forums, messages
Re: 10 Random records, 1 from each category

Posted by --CELKO-- on 12/01/06 19:21

An attribute is an identifier or a category, but not both by
definition. I assume that records means phonographic records so we
would use the RIAA number as the key - hey, no DDL or specs and I am
free to assume industry standards and make the names meaningful.

SELECT R1.record_category, R1.riaa_nbr
FROM Records AS R1
WHERE R1.riaa_nbr =
(SELECT TOP 1 R2.riaa_nbr
FROM Records AS R2
WHERE R1.record_category = R2.record_category
ORDER BY NEWID());

Roy just got the corelation names wrong. This is also untested code.

 

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

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