troubleshooting Question

The row_number in the subselect of an Oracle SQL Query is not picking the exact record.

Avatar of Roberto Madro R.
Roberto Madro R.Flag for United States of America asked on
Oracle Database
28 Comments1 Solution204 ViewsLast Modified:
I've got the query below against the table attached, I'm still getting mixed results as to the customer that has the product although I'm picking on the first instance of the transaction, the problem is only on days when the Model has exchanged hands on the same day.    

select
    modelnumber,
      releasenumber,
      deliverydate,
      deliverytime,
      customer
    from
    (select
    modelnumber,
      releasenumber,
      deliverydate,
      deliverytime,
      customer,
    row_number() over(partition by modelnumber order by deliverydate||deliverytime desc) rn from
    deliveries)
    where rn=1 And
      etc......
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 28 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 1 Answer and 28 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