You are here: Re: Help on a SQL query « MsSQL Server « IT news, forums, messages
Re: Help on a SQL query

Posted by Simon Hayes on 09/14/05 18:34

Oops, sorry - I left out the GROUP BY:

select
t.Contact,
t.Company,
t.Job_Title,
t.Importance
from
dbo.MyTable t
join
(
select Company, max(Importance) as 'Importance'
from dbo.MyTable
group by Company
) dt
on t.Company = dt.Company
and t.Importance = dt.Importance

If this still doesn't work as you require, I suggest you post CREATE
TABLE and INSERT statements to show a test case:

http://www.aspfaq.com/etiquette.asp?id=5006

Simon

 

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

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