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 are the predefined tablespaces in a database?
How can I get column names from a table in oracle?
What are privileges and grants?
What are the differences between char and nchar in oracle?
What is the recommended interval at which to run statspack snapshots, and why?
How to count duplicated values in a column in oracle?
Explain the use of constraints option in exp command.
Explain the difference between sap and oracle?
How to connect ms access to oracle servers?
What is Reduced List of Values?
How do you store pictures in a database?
How to view existing locks on the database?
How to create a server parameter file?
List the various oracle database objects?
Can any one explain me when i execute below query.. select months_between('07-JUL-12','10-FEB-12') from dual; Out put:- 4.90322581 How oracle calculate?