Hi friends,

I have a table with 6 coloumns named:

courseId(varchar)
userid(varchar)
type(varchar) --can be update,preview or live
update(date)
preview(date)
live(date)

the courseId is repeated many times and every entry will have only one of the coloumns which has dates and the other two date coloumns will be empty.

Now I want to retrieve the userid,type and the date coloumn based on the type (for ex if the type is update I want to get the greatest of update coloumn) where type= update and update = greatest(update).


I want the latest two live dates and its complete rows and one latest preview dates and its complete row.

So totally i wnat to retrieve 3 rows based on the courseid and type.

it would be very great ful if somebody help me out to come up giving a rope.

thanx
satish