I want to update the SLA time set on the basis of the Queue Object. I have used a trigger to calculate SLA but do not know how to accommodate Queue in that... Suggestions are requested...

Queues are stored as a Group SObject, so

select Id from Group where Name = 'My Group' and Type = 'Queue'

But how can I retrieve that which case is assigned to which Queue?

```
for( Case caseObj : trigger.new)
    {
        // Access the "old" record by its ID in Trigger.oldMap
        Case oldCase = Trigger.oldMap.get(caseObj.Id);
         if (caseObj.OwnerId != oldCase.OwnerId) {
          //Logic for change of case owner
           System.debug('oldCaseOwner  :  ' + oldCase.OwnerId); 
           System.debug('NewCaseOwner  :  ' + caseObj.OwnerId); 

           // How can I relate the changed owner to the changed Queue. I want the Queue name here.     
         }
         else
           System.debug('No Change in Owner'); } 

```

Also, One Agent can belong to different Queues at a time.