•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Oracle section within the Web Development category of DaniWeb, a massive community of 391,989 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,217 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Oracle advertiser:
Views: 1264 | Replies: 3
![]() |
•
•
Join Date: May 2008
Posts: 33
Reputation:
Rep Power: 1
Solved Threads: 0
Hey guys
I have a table, that lists people, with a correpsonding date and time for each activity. My structure is like:
PersonID......Date............Time
872367.........01/01/08......15:00:00
872367.........01/01/08......16:00:00
872367.........01/01/08......18:00:00
976737.........01/01/08......19:00:00
976737.........02/01/08......16:00:00
911967.........03/01/08......18:00:00
I want to have a query that returns each persons latest activity date and time, so I want a table like:
PersonID......Date............Time
872367.........01/01/08......18:00:00
976737.........02/01/08......16:00:00
911967.........03/01/08......18:00:00
I tried something like
This returned the
PersonID, latest activity date for that person, but not the latest time for that date, just the latest time for that person, if that makes sense?
So I got something like:
PersonID......Date............Time
872367.........01/01/08......18:00:00
976737.........02/01/08......19:00:00
911967.........03/01/08......18:00:00
Notice how the second row of data has the max date for that person, and the max time for that person - I need the max date for that person, and the max time for that date
Thanks for any help!
I have a table, that lists people, with a correpsonding date and time for each activity. My structure is like:
PersonID......Date............Time
872367.........01/01/08......15:00:00
872367.........01/01/08......16:00:00
872367.........01/01/08......18:00:00
976737.........01/01/08......19:00:00
976737.........02/01/08......16:00:00
911967.........03/01/08......18:00:00
I want to have a query that returns each persons latest activity date and time, so I want a table like:
PersonID......Date............Time
872367.........01/01/08......18:00:00
976737.........02/01/08......16:00:00
911967.........03/01/08......18:00:00
I tried something like
select PersonID, max(Date), max(Time) from myTable group by PersonID
This returned the
PersonID, latest activity date for that person, but not the latest time for that date, just the latest time for that person, if that makes sense?
So I got something like:
PersonID......Date............Time
872367.........01/01/08......18:00:00
976737.........02/01/08......19:00:00
911967.........03/01/08......18:00:00
Notice how the second row of data has the max date for that person, and the max time for that person - I need the max date for that person, and the max time for that date
Thanks for any help!
SQL Syntax (Toggle Plain Text)
SELECT ID, date, time FROM tbl WHERE date =(SELECT max(date) FROM tbl) AND time= (SELECT max(time) FROM tbl) GROUP BY ID
?
thowwy!!!! >_<
This should work ..
+_+
sql Syntax (Toggle Plain Text)
SELECT id, date1, max(timee) FROM datetime GROUP BY id, date1
This should work ..
+_+
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Oracle Marketplace
- <cfmail> question (ColdFusion)
- memory management in wndows 2000 (Windows NT / 2000 / XP / 2003)
- ASP Form error (ASP)
- assist to show the applet (Java)
- I need help covert my source code frm pic16c54a to pic16f84a (Assembly)
- Identifying Drivers needed (Windows 9x / Me)
- hover over text tips (JavaScript / DHTML / AJAX)
- generating an auto number (Visual Basic 4 / 5 / 6)
Other Threads in the Oracle Forum
- Previous Thread: helpp....correct d code
- Next Thread: What is Oracle Forms and Reports?


Linear Mode