You are here: Re: T-SQL for the following? « MsSQL Server « IT news, forums, messages
Re: T-SQL for the following?

Posted by KenJ on 02/22/07 03:33

Hi Mark,

This query gets the result you were looking for. I don't know if it
works for cases that weren't represented by the numbers in your
example.

SELECT
aID
, min(bID) AS bID
, max(cID) AS cID
, dID
FROM
@tbl
GROUP BY
aID
, dID
ORDER BY
dID

Thanks,

Ken



On Feb 21, 6:21 pm, Mark Probert <probe...@gmail.com> wrote:
> Hi ..
>
> I am geeting myself into many knots around how to do thsi extraction.
>
> There is a table that contains the following:
>
> aID bID cID dID
> --------------------------
> 6 9 28 1
> 6 2 28 2
> 6 11 28 3
> 6 1 27 5
> 6 9 27 5
> 6 11 27 5
>
> I am trying to get a result of:
>
> aID bID cID dID
> --------------------------
> 6 9 28 1
> 6 2 28 2
> 6 11 28 3
> 6 1 27 5
>
> So, something like "the set off all values over bID which have the
> greatest cID". Any ideas?
>
> Many thanks, in advance,
>
> --
> -mark.

 

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

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