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
How to see free space of each tablespace?
Explain a synonym?
Differentiate between function and procedure in oracle.
How to delete an existing row from a table in oracle?
What are set operators?
How to get execution statistics reports on query statements?
How to change system global area (sga) in oracle?
Name the three major set of files on disk that compose a database in Oracle?
Can u please explain me the Discussion on Except ,using cast like type cast. Question in the context of difference between two tables
How to run queries on external tables?
What is difference between cartesian join and cross join?
How to select all columns of all rows from a table in oracle?
What is hot backup and logical backup?
definition of cluster and non-clustered index?
How to convert characters to times in oracle?