$sql="select COL_CALL as `call`, COUNT(DISTINCT(SUBSTR(COL_GRIDSQUARE,1,4))) AS `count`, GROUP_CONCAT(DISTINCT SUBSTR(`COL_GRIDSQUARE`,1,4) ORDER BY `COL_GRIDSQUARE` SEPARATOR ', ') AS `grids` from ".$this->config->item('table_name')." WHERE station_id in (".$location_list.")";
if($band!='All'){
if($band=='SAT'){
switch($leogeo){
case'both':
$sql.=" and col_prop_mode ='".$band."'";
break;
case'leo':
$sql.=" and col_prop_mode = '".$band."'";
$sql.=" and col_sat_name != 'QO-100'";
break;
case'geo':
$sql.=" and col_prop_mode = '".$band."'";
$sql.=" and col_sat_name = 'QO-100'";
break;
default:
$sql.=" and col_prop_mode ='".$band."'";
break;
}
}
else{
$sql.=" and col_prop_mode !='SAT'";
$sql.=" and COL_BAND ='".$band."'";
}
}
$sql.=" AND `COL_GRIDSQUARE` != '' GROUP BY `COL_CALL` HAVING `count` >= ".$mincount." ORDER BY `count` DESC;";
$sql="SELECT DISTINCT COL_CALL AS `call`, GROUP_CONCAT(COL_VUCC_GRIDS) AS `vucc_grids` FROM ".$this->config->item('table_name')." WHERE station_id in (".$location_list.")";
"select COUNT(DISTINCT(SUBSTR(COL_GRIDSQUARE,1,4))) AS `count` from ".$this->config->item('table_name')." WHERE station_id in (".$location_list.") AND `COL_GRIDSQUARE` != '' GROUP BY `COL_CALL` ORDER BY `count` DESC LIMIT 1"