Subject | Re: [firebird-support] group by ?? |
---|---|
Author | Robert martin |
Post date | 2008-06-09T20:45:30Z |
Hi
If I understand the situation correctly the following should give the
desired outcome
SELECT m.MOVI, m.PROC, m.DSCR, m.FECH, m.HORA, m.DSCR
FROM MOVI m
WHERE m.MOVI IN (SELECT MAX(m2.MOVI) FROM MOVI m2 GROUP BY m2.PROC)
--
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd
danyschaer wrote:
If I understand the situation correctly the following should give the
desired outcome
SELECT m.MOVI, m.PROC, m.DSCR, m.FECH, m.HORA, m.DSCR
FROM MOVI m
WHERE m.MOVI IN (SELECT MAX(m2.MOVI) FROM MOVI m2 GROUP BY m2.PROC)
--
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd
danyschaer wrote:
> Hi All;
>
> I have a table named MOVI with (as an example) this fields:
>
> MOVI Char(10)
> PROC Char(10)
> DSCR Char(10)
> FECH Char(8)
> HORA Char(4)
> DSCR Varchar(200)
>
> I have to obtain all the fields for each record that is the MAX(FECH)
> from groups of PROC:
>
> select "PROC", max("FECH") from "MOVI" group by "PROC"
>
> Like this, but I have to get all the fields. How can I do that?.
>
> Thank you!
>
> Dany
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>
>
>
>
>