Selecting different values from different columns I need a query to select different values from different columns as shown below:



timestamp          queues           queuesname        groupnumb
23-01-2014         FNG              CGI               15467P
24-02-2014         ACS              GHK               15467P
26-02-2014         ERT              FNG               15467P
01-03-2014         ACS              TYU               15467P
04-05-2014         TYI              GHK               15467P


I need the the row with queues = ACS (latest one has timestamp 01-03-2014) and queuesname = GHK (latest one has timestamp 04-05-2014)

For the above example I need this output:

Min_timestamp      max_timestamp       queues       queuesname    groupn
01-03-2014         04-05-2014          ACS          GHK           15467P


I don't need a hard coded query.
It's not very clear what you are after but here's a query under my understanding that you want to find the last timestamp where queues = 'ACS' and the last timestamp where queuesname = 'GHK' for every groupnumb:

with grp as
  ( select groupnumb, max(timestamp) as timestamp
    from tableX
    where queues = 'ACS'
    group by groupnumb
  union all
    select groupnumb, max(timestamp)        
    from tableX
    where  queuesname = 'GHK'
    group by groupnumb
  )
select min(timestamp) as min_timestamp,
       max(timestamp) as max_timestamp,
       groupnumb
from grp
group by groupnumb ;