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 / vijay_1994

with temp as (select
service type,
paid,
vechile no,
dense_rank()over(order by date asc) as a
from table
select * from temp where a<=3;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

641


What is group by in sql?

635


How can you tell the difference between an index and a view?

591


What are the types of optimization?

604


Can variables be used in sql statements?

644






explain commit and rollback in mysql : sql dba

642


Is sql database free?

624


how to get @@error and @@rowcount at the same time? : Sql dba

634


what are rollup and cube in t-sql? : Transact sql

737


What are character functions in sql?

572


What does partition by mean in sql?

597


What is data profiling in sql?

633


What are all the different normalizations?

669


i have a column which may contain this kind of value: 123*67_80,12*8889_5,34*8_874 ,12*7_7 (can contain space before a comma, and this string length can be anything) now i want to split this value into two column like: column1: 123*67,12*8889,34*8,12*7 column2: 80,5,874,7 use function for this

1184


What are sql built in functions?

598