in sql table following column r there
i want find 1st paid ,2nd paid,3rd paid date for same
|service_type|date |vehicle_no|
|------------|------|_---------|
|paid |23 jan|MH12H2007 |
| | | |
|paid |26 feb|MH12H2007 |
| | | |
| | | |
|paid |28 mar|MH12H2007 |
i want o/p like below
vehicle no| 1st paid date | 2nd paid date|3rd paid |latest
paid date|

pls help me out

Answer Posted / sudipta santra

select distinct service_type,date,vehicle_no from
vehicle_service
where vehicle_no='MH12H2007' and service_type='paid' and
rownum<4
order by date desc

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I view a table in sql?

551


What is scope and visibility in PL/SQL?

608


what is sql server agent? : Sql dba

610


Is null operator in sql?

617


Why do we create stored procedures & functions in pl/sql and how are they different?

513






What is pl/sql table? Why it is used?

573


Why is theta join required?

675


What are inner and outer joins examples of both?

503


What are sql constraints?

572


How do I find duplicates in sql?

515


How to raise user-defined exception with custom sqlerrm ?

686


How to run pl/sql statements in sql*plus?

601


can a stored procedure call itself or recursive stored procedure? How much level sp nesting is possible? : Sql dba

541


What are the different types of joins in sql?

589


Advantages and disadvantages of stored procedure?

592