Zargo
Programmer
- Mar 21, 2005
- 109
Hi all,
I have a table with the following info:
TableA
log_index | description | User_name | Log_date
1000 file created UserX 01-11-2005 00:00:00
4564 deleted UserB 06-05-2005 12:30:10
5489 accepted UserA 08-06-2005 12:23:00
5332 rejected UserA 08-06-2005 12:23:00
5466 returned UserC 07-11-2005 12:10:00
5001 received UserD 01-04-2005 11:00:00
5001 saved UserX 01-01-2004 12:00:00
Who can i get the records of users who hasn't used the application (log_index beginning with 5) more then 3 months?
So i only want the users and the last date he/she has used the application(all log_indexes beginning with a 5)
The result must be:
User_name | Last_date
UserA 08-06-2005 12:23:00
UserD 01-04-2005 11:00:00
I have tried
select user_name, log_date as Last_date
from TableA where log_index
like '5%' and extract(month from log_date) >= 3
But i don't get the right records returned. I have also tried with the GROUP BY clause and ROWNUM = 1 but without success.
Does anybody know how to write the Query?
A star for the golden answer.
Thanks a lot...
Zargo
I have a table with the following info:
TableA
log_index | description | User_name | Log_date
1000 file created UserX 01-11-2005 00:00:00
4564 deleted UserB 06-05-2005 12:30:10
5489 accepted UserA 08-06-2005 12:23:00
5332 rejected UserA 08-06-2005 12:23:00
5466 returned UserC 07-11-2005 12:10:00
5001 received UserD 01-04-2005 11:00:00
5001 saved UserX 01-01-2004 12:00:00
Who can i get the records of users who hasn't used the application (log_index beginning with 5) more then 3 months?
So i only want the users and the last date he/she has used the application(all log_indexes beginning with a 5)
The result must be:
User_name | Last_date
UserA 08-06-2005 12:23:00
UserD 01-04-2005 11:00:00
I have tried
select user_name, log_date as Last_date
from TableA where log_index
like '5%' and extract(month from log_date) >= 3
But i don't get the right records returned. I have also tried with the GROUP BY clause and ROWNUM = 1 but without success.
Does anybody know how to write the Query?
A star for the golden answer.
Thanks a lot...
Zargo