Q:

Using Asc offset and desc in psql

This code produces this
SELECT "End_Date"+5                                                   
                FROM exhibits e, rooms r, PlaceOfExhibition p
                WHERE "End_Date">CURRENT_DATE+5 AND r."Minimum" >= 7 and
r."Maximum" <= 16 and p."Location"=r."Name" and e."Name" = p."Exhibition" ORDER
BY "End_Date" desc;
  ?column?  
------------
 2017-01-15
 2016-12-20
 2016-10-22
 2016-09-20
(2 rows)

I require that 2016-12-20 date(the second biggest one), I don't always need the second biggest one though it depends on what is count is from rooms(if the rooms query returns 4 then I need the fourth biggest one)
I require to get this from a subquery
This is the subquery I have
SELECT "End_Date"+5                                                   
                FROM exhibits e, rooms r, PlaceOfExhibition p
                WHERE "End_Date">CURRENT_DATE+5 AND r."Minimum" >= 7 and
r."Maximum" <= 16 and p."Location"=r."Name" and e."Name" = p."Exhibition" ORDER
BY "End_Date" ASC OFFSET (Select Count("Name")-1 FROM Rooms Where "Minimum">=7
and "Maximum"<=16) LIMIT 1 ;

Which returns this
2016-10-22

So my query is getting the second last date but in the wrong direction, it is getting the second smallest instead of the second largest

A:

SELECT "End_Date"+5                                                   
                FROM exhibits e, rooms r, PlaceOfExhibition p
                WHERE "End_Date">CURRENT_DATE+5 AND r."Minimum" >= 7 and
r."Maximum" <= 16 and p."Location"=r."Name" and e."Name" = p."Exhibition" ORDER
BY "End_Date" DESC OFFSET (Select Count("Name")-1 FROM Rooms Where "Minimum">=7
and "Maximum"<=16) LIMIT 1 ;

