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 / garima
SELECT (case when a_id > b_id then 'Greater' else 'Lesser'
end), a_id, b_id
FROM (SELECT ROWNUM r_a, account_id a_id
FROM customer) a,
(SELECT ROWNUM r_b, account_id b_id
FROM customer) b
where r_a = r_b+1;
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is a dead lock in oracle?
Explain the difference between a procedure and a function?
What are the types of trigger in oracle?
What is merge in oracle?
What is oracle open database communication (odbc)?
What is a dynamic performance view in oracle?
What are the restrictions in a oracle read only transaction?
How to insert a record into a table?
How to create a new table by selecting rows from another table?
What is an oracle database?
what is normalisation?what are its uses?
If a parameter is used in a query without being previously defined, what diff. exist betw. report 2.0 and 2.5 when the query is applied ?
How to get maxsal , minsal, ename department wise in single query
What is a proxy object?
What happens in oracle commit?