Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 Help Members By Posting Answers For Below Questions

Please explain joins in oracle?

1023


Query to retrieve record for a many to many relationship ?

2472


How to get a create statement for an existing table?

925


What are the benefits of ordbms?

1050


What is archive log in Oracle?

1085


What is the data type of dual table?

939


Difference between varchar and varchar2 data types?

1139


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?

1064


How different is ms access and oracle?

997


What is the usage of control file in oracle?

1046


How to use "for" statements in oracle?

1038


Hi Can any one tell me what are the API's used in requisition import.

1892


Does facebook use oracle?

996


What is the difference between primary key and unique key and foreign key in oracle?

938


Explain integrity constraint?

1126