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
Can the query output be sorted by multiple columns in oracle?
How to bring a tablespace online?
What is oracle join syntax?
How to create a table interactively?
How to retrieve data from an explicit cursor?
How to view existing locks on the database?
What are the common oracle dba tasks?
What are a cluster and non-cluster index?
What are nested tables?
What is merge in oracle?
How to create tables for odbc connection testing?
What are the differences between char and nchar in oracle?
What are the restrictions in a oracle read only transaction?
Explain cascading triggers.
How do I recompile a procedure in oracle?