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
What is raw datatype in oracle?
What are the numeric comparison operations?
What are the different windows events activated at runtime ?
How do I know if oracle client is installed on windows?
What privilege is needed for a user to query tables in another schema?
State some uses of redo log files?
How to convert character types to numeric types?
you are a universe designer and report developer in BO, what type of information you gather from client?Briefly explain plz
What are the limitations of check constraint?
What is oracle latest version?
What privilege is needed for a user to create indexes in oracle?
Explain coalesce function?
Difference between the “verify” and “feedback” command?
How do I spool to a csv formatted file using sqlplus?
Explain the use of rows option in imp command.