We need to compare two successive records of a table based
on a field. For example, if the table is CUSTOMER, and the
filed is Account_ID, To compare Account_IDs of record1 and
record2 of CUSTOMER table, what can be the query ?

Answer Posted / manikandan. s

WITH wt AS
(SELECT ROWNUM sl, a.Account_ID
FROM CUSTOMER a)
SELECT a1.*
FROM wt a1, wt a2
WHERE a1.sl = a2.sl + 1 AND a1.col1 = a2.col1
UNION
SELECT a2.*
FROM wt a1, wt a2
WHERE a1.sl = a2.sl + 1 AND a1.col1 = a2.col1

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is raw datatype in oracle?

586


What are the numeric comparison operations?

633


What are the different windows events activated at runtime ?

2410


How do I know if oracle client is installed on windows?

500


What privilege is needed for a user to query tables in another schema?

513






State some uses of redo log files?

568


How to convert character types to numeric types?

581


you are a universe designer and report developer in BO, what type of information you gather from client?Briefly explain plz

1564


What are the limitations of check constraint?

575


What is oracle latest version?

588


What privilege is needed for a user to create indexes in oracle?

580


Explain coalesce function?

630


Difference between the “verify” and “feedback” command?

775


How do I spool to a csv formatted file using sqlplus?

550


Explain the use of rows option in imp command.

604