You are here: Re: T-SQL Question « MsSQL Server « IT news, forums, messages
Re: T-SQL Question

Posted by Aaron Bertrand [SQL Server MVP] on 11/12/06 22:08

SELECT s.*
FROM sometable s
INNER JOIN
(
SELECT rec_id,
rs = MAX(rec_sequence)
FROM alppremh
GROUP BY rec_id
) a
ON s.rec_id = a.rec_id
AND s.rec_sequence = a.rs;





"klabu" <noone_at_gmail_dot_com> wrote in message
news:12lf5tld76k2o21@corp.supernews.com...
> How to write an equivalent SQL like this (which works on Oracle):
>
> SELECT * FROM sometable
> WHERE rec_id, rec_sequence
> IN (SELECT rec_id, MAX( rec_sequence) FROM alppremh GROUP BY rec_id)
>
> thanks
>

 

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

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