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 login to the server without an instance?
How do we represent comments in oracle?
What is an Oracle index?
How to get a list of all background sessions in the database?
Explain drop constraint oracle?
What will be the syntax to find current date and time in format "yyyy-mm-dd"?
Typically, where is the conventional directory structure chosen for Oracle binaries to reside?
What are the various oracle database objects?
How translate command is different from replace?
Give the various exception types.
Explain the use of grant option in imp command.
How can we find out the duplicate values in an oracle table?
What is logical backup in oracle?
What do you mean by merge in oracle and how can we merge two tables?
How different is ms access and oracle?