Aqui está a minha consulta geral sem MAX
SELECT "job_routing"."order-no", "job_routing"."work-ctr", "job_routing"."complete-date"
FROM "E940LIVE"."PUB"."job-routing" "job_routing"
WHERE "job_routing"."company"='01' AND "job_routing"."resource-group" LIKE 'E1%' AND "job_routing"."complete-date">>{d '2008-11-11'}
Encontrei um código semelhante, mas simplesmente não o entendi o suficiente para fazê-lo funcionar para mim.
Isto é o que encontrei:
CREATE TABLE PersonalInfo
(
first_name VARCHAR(25) NOT NULL,
last_name VARCHAR(25) NOT NULL,
birth_date DATETIME NOT NULL,
address VARCHAR(25) NOT NULL,
city VARCHAR(25) NOT NULL,
state CHAR(2) NOT NULL,
country CHAR(2) NOT NULL,
PRIMARY KEY (last_name, first_name)
)
SELECT P.*
FROM (SELECT country, state, city, MIN(birth_date) AS birth_date
FROM PersonalInfo
GROUP BY country, state, city) AS O
INNER JOIN
PersonalInfo AS P
ON P.country = O.country AND
P.state = O.state AND
P.city = O.city AND
P.birth_date = O.birth_date
Obrigado
Wayne