troubleshooting Question

Request a query to compare timestamp

Avatar of jl66
jl66Flag for United States of America asked on
Oracle DatabaseSQL
4 Comments2 Solutions362 ViewsLast Modified:
Have a table T with the columns/records
GROUP    NAME    T1         T2
2             BB        7/1/11    7/3/11
2             SS        7/5/11    7/6/11
3             SS        7/1/11    7/3/11
3             CC        7/5/11    7/6/11
3             DD        7/4/11    7/6/11
4             SS        8/1/11    8/2/11
4             SS        8/3/11    8/3/11
....
Select the records in each group like 2, 3,... if Name =SS and T1 > T2 (here T2 comes from any other record in the same group). For example,

2       SS        7/5/11    7/6/11   -- selected because its T1=7/5/11 > T2=7/3/11 (other record in the same group)

However, none of records are selected from group =3.

Similarly, the following record is selected
4       SS        8/3/11    8/3/11

I tried to use " over partition by ...". Just missed something.  I will greatly appreciate any guru's advice/queries.
ASKER CERTIFIED SOLUTION
paquicuba

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros