"JN" <jirinej@volny. czschrieb im Newsbeitrag
news:7e29a94a.0 307090205.179bc a49@posting.goo gle.com...
all
Firstl of all: it's not too smart posting your
question without enough infos. At least the
table definition and a few rows of data...
Second: don't try to name your columns
using restricted words (date).
Anyway: a possible solution (I obviously don't
know your rdbms version) would be:
select * from gktest;
PERSON_ID DAT TIME CODE
--------- -------- ----- ----------
1 26.04.98 07:00 First one
2 08.07.03 16:00 Second
2 09.07.03 13:00 Third
2 09.07.03 11:00 Fourth
select * from gktest
where dat=(select max(dat) from gktest)
and time=(select max(time) from gktest
where dat=(select max(dat) from gktest)
);
PERSON_ID DAT TIME CODE
--------- -------- ----- ----------
2 09.07.03 13:00 Third
Some other ways do exist to reach your goal.
hth,
Guido
news:7e29a94a.0 307090205.179bc a49@posting.goo gle.com...
I record attendance of persons to table with these columns:
PERSON_ID, DATE, TIME, CODE .
Is it possible to write SQL query, which gives me latest record of
PERSON_ID, DATE, TIME, CODE .
Is it possible to write SQL query, which gives me latest record of
persons? Unfortunately, the DATE and TIME are separate columns.
Thanks for any ideas.
Thanks for any ideas.
question without enough infos. At least the
table definition and a few rows of data...
Second: don't try to name your columns
using restricted words (date).
Anyway: a possible solution (I obviously don't
know your rdbms version) would be:
select * from gktest;
PERSON_ID DAT TIME CODE
--------- -------- ----- ----------
1 26.04.98 07:00 First one
2 08.07.03 16:00 Second
2 09.07.03 13:00 Third
2 09.07.03 11:00 Fourth
select * from gktest
where dat=(select max(dat) from gktest)
and time=(select max(time) from gktest
where dat=(select max(dat) from gktest)
);
PERSON_ID DAT TIME CODE
--------- -------- ----- ----------
2 09.07.03 13:00 Third
Some other ways do exist to reach your goal.
hth,
Guido