You are here: Re: brain teaser - stagger the order of the results « MsSQL Server « IT news, forums, messages
Re: brain teaser - stagger the order of the results

Posted by David Portas on 09/05/05 15:45

It would be useful to see how you compute the Rank value. Perhaps your
result is possible by adapting your existing query. From what you've
given us, try this:

SELECT T1.item_name, T1.manufacturer, T1.rank
FROM (/* Your query */) AS T1
JOIN (/* Your query */) AS T2
ON T1.manufacturer = T2.manufacturer
AND T1.rank <= T2.rank
GROUP BY T1.item_name, T1.manufacturer, T1.rank
ORDER BY COUNT(*), T1.rank DESC

Just substitute your query or a view that contains it after the FROM
and JOIN.

--
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

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