Subject | RE: Possible to use FIRST 1 inside a group by? |
---|---|
Author | Maya Opperman |
Post date | 2015-07-30T06:07:06Z |
Thank you for the help everyone!
I think Sean's looks the most efficient, as that will only run the sub-query once.
Now that I know how to use this trick, I think I could use this in quite a few other places too ;-)
I think Sean's looks the most efficient, as that will only run the sub-query once.
Now that I know how to use this trick, I think I could use this in quite a few other places too ;-)
>Try:
>SELECT
> T.ID
> T.GroupID
> T2.FKCode
> T2.Value
>FROM (
> select MIN (ID) as ID, GroupID
> from MyTable
> GROUP BY GroupID
> ) T
> JOIN MyTable T2 ON T2.ID = T.ID
>
>Sean