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 happens to the indexes if a table is recovered?
What is raw datatype?
How do you bind variables in oracle?
What privilege is needed for a user to delete rows from tables in another schema?
What are the different types of modules in oracle forms?
What happens internally when the user types userID/password@string in SQL PLUS Thanks-Bhaskar
What are the components of logical database structure in oracle database?
How to grant create session privilege to a user in oracle?
How to declare a local variable?
How would you configure your networking files to connect to a database by the name of DSS which resides in domain icallinc.com?
When system tablespace is created?
How to count duplicated values in a column in oracle?
How to create a stored procedure in oracle?
What are the different oracle database objects?
What happens if variable names collide with table/column names?