sql=switch_mprintf("SELECT *,(%"SWITCH_TIME_T_FMT"-joined_epoch)+base_score+skill_score AS score FROM members WHERE queue = '%q' ORDER BY score DESC;",local_epoch_time_now(NULL),queue_name);
if(queue_name){
sql=switch_mprintf("SELECT *,(%"SWITCH_TIME_T_FMT"-joined_epoch)+base_score+skill_score AS score FROM members WHERE queue = '%q' ORDER BY score DESC;",local_epoch_time_now(NULL),queue_name);
}else{
sql=switch_mprintf("SELECT *,(%"SWITCH_TIME_T_FMT"-joined_epoch)+base_score+skill_score AS score FROM members ORDER BY queue, score DESC;",local_epoch_time_now(NULL));