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
Please explain joins in oracle?
Query to retrieve record for a many to many relationship ?
How to get a create statement for an existing table?
What are the benefits of ordbms?
What is archive log in Oracle?
What is the data type of dual table?
Difference between varchar and varchar2 data types?
I have a table called 'test' on source and target with same name, structure and data type but in a different column order. How can you setup replication for this table?
How different is ms access and oracle?
What is the usage of control file in oracle?
How to use "for" statements in oracle?
Hi Can any one tell me what are the API's used in requisition import.
Does facebook use oracle?
What is the difference between primary key and unique key and foreign key in oracle?
Explain integrity constraint?