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
How to pass parameters to procedures in oracle?
what is the use of triggers in Java program? I mean where do we use triggers in Java programming?
How to fetch the row which has the max value for a column?
How do I manually create a database in oracle?
How to start your 10g xe server?
What happens to the current transaction if a ddl statement is executed?
What is rich query?
Is postgres faster than oracle?
Explain the difference between replace() and translate() functions in oracle?
Explain the use of compress option in exp command.
How to experiment a data lock in oracle?
What is an oracle data file?
Differentiate between pre-select and pre-query?
What is a static data dictionary in oracle?
How view is different from a table?