Home » SQL & PL/SQL » SQL & PL/SQL » updated/new records fetch (Oracle 10g)
updated/new records fetch [message #348975] Thu, 18 September 2008 07:55 Go to next message
mrpranab
Messages: 32
Registered: March 2005
Member
Hi,
I have a query and need your suggestion.

I have two tables viz. A and B.

A
--------
ID
start_dt
comment
status
stat_cd

B
------------
ID
start_dt
comment
status
stat_cd

The ID field need to compare in both tables.I need to select those records from B table where comment or status value
has changed for previous day records where A.ID = B.ID and A.start_dt = B.start_dt else we dont need to fetch record from B table. If new ID present on B table for previous day record where that ID not found in A table then we also need to select new record.

can you please tell how this can be solved... any function or any approach i can use if you have already done this type of query.

Thanks in adv.
Re: updated/new records fetch [message #348983 is a reply to message #348975] Thu, 18 September 2008 08:32 Go to previous message
Michel Cadot
Messages: 64121
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Have a look at LAG/LEAD functions.

Regards
Michel
Previous Topic: Time taken by query
Next Topic: sample data printing
Goto Forum:
  


Current Time: Wed Dec 07 03:06:55 CST 2016

Total time taken to generate the page: 0.09135 seconds