Subject | Re: [firebird-support] How do I get the latest date of a column in a join |
---|---|
Author | Alexandre Benson Smith |
Post date | 2004-06-28T23:08:53Z |
Ray Jenkins wrote:
What about the t.CreationDateTime field ?
When you use an agrgate funciont, every other column in the query should
be on the group by clause.
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
>I need to join two tables together and get the latest date in a column in the right table for every record in the left tableHi Ray,
>
>My attempt was this sql:
>
>SELECT t.Name, t.CreationDateTime, Max(r.TimeStamp)
> FROM
> Test t left join Results r on t.TestProgramID = r.TestProgramID
> WHERE t.Archived = 1
> GROUP BY t.Name
>
>I get an SQL error -104, Invalid expresion in the Aggregate function or the Group By Statement
>
>If I take out the Max function and the Group by statement, I get a list of all Timestamps for each Left side record like I would expect.
>
>Why isn't the Max function working? Is there a different way?
>
>Thanks
>Ray
>
>
>
What about the t.CreationDateTime field ?
When you use an agrgate funciont, every other column in the query should
be on the group by clause.
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br