Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6731365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:31:11+00:00 2026-05-26T10:31:11+00:00

I was hoping someone could help me in resolving this issue. I have 3

  • 0

I was hoping someone could help me in resolving this issue.

I have 3 tables.

Every table has an ID that I can use to connect all of them together. Those ID’s are not the same ones, but they work and connect to each other alright.

What I need to get is LATEST update date (timestamp) for certain product number (could be more than one product) what was status for it.

Here are how tables look like (they are much more complex, but i simplified them)

mercury.cs_batch_event
PRODUCT_ID (VARCHAR2(100 CHAR))
CBL_REQUEST_ID (VARCHAR2(12 CHAR))

mercury.cs_status_srch
CBL_REQUEST_ID (VARCHAR2(12 CHAR))
LOG_ID  (VARCHAR2(12 CHAR))
STATUS_REF_ID (NUMBER(8,0))

mercury.edit_log
ELOG_ID (VARCHAR2(12 CHAR))
ON_DATE_TIME (TIMESTAMP(6))

I tried doing it several different ways, and after searching for a while on the internet, closest i could get to was this:

SELECT * 
FROM (SELECT cbl.product_id, src.status_ref_id,
             TO_CHAR(elog.on_date_time, 'dd/mm/yyyy hh24:mi:ss') date_updated
      FROM mercury.cs_batch_event cbl,
           mercury.cs_status_srch src, 
           mercury.edit_log elog
      WHERE cbl.product_id IN ('A555', 'B555')
        AND cbl.cbl_request_id = src.cbl_request_id
        AND src.log_id = elog.elog_id
      ORDER BY elog.on_date_time DESC)
WHERE rownum = 1

And it returned below which is correct, but when several product numbers are inserted it still returns value for only one product (Which is because of the row number=1 probably)

PRODUCT_NUMBER  DATE_UPDATED        STATUS
A555            29/06/2011 07:51:24 30169

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:31:12+00:00Added an answer on May 26, 2026 at 10:31 am

    This should do it:

    SELECT 
      t1.product_number, 
      t2.status, 
      TO_CHAR (t3.update_time, 'dd/mm/yyyy hh24:mi:ss') date_updated,
    FROM 
      batch_event t1, 
      status_srch t2, 
      edit_log t3
    WHERE 
      t1.product_number in ('A555', 'B555')
      AND t1.ID_1 = t2.ID_1
      AND t2.ID_2 = t3.ID_2
      AND t3.update_time = (SELECT max(update_time) 
                            FROM edit_log 
                            WHERE ID_2 = t3.ID_2)
    

    Ahh, think I misunderstood your data.. Try this instead:

    SELECT 
      t1.product_number,
      t2.status,
      t3.update_time
    FROM 
      batch_event t1, 
      status_srch t2, 
      edit_log t3,
    (
        SELECT 
          batch_event.product_number product_number, 
          max(edit_log.update_time) maxupdatetime,
        FROM 
          batch_event, 
          status_srch, 
          edit_log
        WHERE 
          batch_event.ID_1 = status_srch.ID_1
          AND status_srch.ID_2 = edit_log.ID_2
        GROUP BY
          batch_event.product_number
    ) t4
    WHERE t1.ID_1 = t2.ID_1
    AND t2.ID_2 = t3.ID_2
    AND t1.product_number = t4.product_number
    AND t3.update_time = t4.maxupdatetime
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an interesting problem that I was hoping someone could help to shed
I was hoping someone could help me with this I have data like this
I have 2 questions that I was hoping someone could help me with. Is
I was hoping someone could help me with a little issue I'm having trouble
HI All I was hoping someone could help me improve a query I have
I was hoping someone could help me out with this stupid problem I'm having
I have no idea what's going on here and was hoping someone could help,
hoping someone can help me out with this. I'm trying to figure out whether
first time poster. Was hoping someone could help me with this. In section 5.10,
I'm having trouble with one particular issue, I was hoping someone could help me

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.