Mark Wilson
asked on
Derived Table Problem
I am trying to use a derived table as part of a query in informix. I am tring to show the maximum date from it.
I keep getting error messages, which are not helpful i.e. Unknown error message number '-201'
select a.activity_date
from
(select casact.caseid, max(casact.activity_date)
from arista01:student1.casact casact
group by casact.caseid) a
Does anybody know the correct syntax for the above query?
Thanks
I keep getting error messages, which are not helpful i.e. Unknown error message number '-201'
select a.activity_date
from
(select casact.caseid, max(casact.activity_date)
from arista01:student1.casact casact
group by casact.caseid) a
Does anybody know the correct syntax for the above query?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the answers, I will have a look at what you suggest
max(casact.activity_date)
Does NOT automatically retain column name of activity_date. This is an expression, so you are going to get an untitled column or Expr1 or something to that effect. Then in your outer query you are wanting to call by name activity_date, so you will need to do something like this:
max(casact.activity_date) AS activity_date
That will alias the expression back to a column name of activity_date.