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 / manikandan. s

WITH wt AS
(SELECT ROWNUM sl, a.Account_ID
FROM CUSTOMER a)
SELECT a1.*
FROM wt a1, wt a2
WHERE a1.sl = a2.sl + 1 AND a1.col1 = a2.col1
UNION
SELECT a2.*
FROM wt a1, wt a2
WHERE a1.sl = a2.sl + 1 AND a1.col1 = a2.col1

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to pass parameters to procedures in oracle?

993


what is the use of triggers in Java program? I mean where do we use triggers in Java programming?

2127


How to fetch the row which has the max value for a column?

947


How do I manually create a database in oracle?

955


How to start your 10g xe server?

970


What happens to the current transaction if a ddl statement is executed?

950


What is rich query?

926


Is postgres faster than oracle?

969


Explain the difference between replace() and translate() functions in oracle?

974


Explain the use of compress option in exp command.

965


How to experiment a data lock in oracle?

999


What is an oracle data file?

1035


Differentiate between pre-select and pre-query?

1052


What is a static data dictionary in oracle?

1024


How view is different from a table?

967