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 can we encrypt and decrypt a data present in a mysql table using mysql? : Sql dba

730


What is sql and also describe types of sql statements?

639


What is trigger in sql?

661


What is difference between sql and mysql?

636


Why are aggregate functions called so?

612






What is the difference between a subquery and a join?

604


Can we use pl sql in mysql?

610


What trigger means?

653


Can there be more than one function with a similar name in a pl/sql block?

633


Is json a nosql?

625


Explain two easy sql optimizations.

688


Is join an inner join?

631


what is a record in a database ? : Sql dba

655


What is pl/sql language case sensitive?

730


Is merge a dml statement?

625