Fix SQL JOIN in get_last_qsos for station_profile
Changed the SQL query in get_last_qsos to use LEFT JOIN for station_profile instead of JOIN. This ensures that QSOs are returned even if there is no matching station_profile, improving data completeness.
这个提交包含在:
父节点
3f8f81364b
当前提交
5c4c1c2cd5
共有 1 个文件被更改,包括 6 次插入 和 7 次删除
|
|
@ -1932,7 +1932,6 @@ class Logbook_model extends CI_Model
|
||||||
|
|
||||||
function get_last_qsos($num, $StationLocationsArray = null)
|
function get_last_qsos($num, $StationLocationsArray = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($StationLocationsArray == null) {
|
if ($StationLocationsArray == null) {
|
||||||
$CI = &get_instance();
|
$CI = &get_instance();
|
||||||
$CI->load->model('logbooks_model');
|
$CI->load->model('logbooks_model');
|
||||||
|
|
@ -1945,13 +1944,13 @@ class Logbook_model extends CI_Model
|
||||||
$location_list = "'" . implode("','", $logbooks_locations_array) . "'";
|
$location_list = "'" . implode("','", $logbooks_locations_array) . "'";
|
||||||
|
|
||||||
$sql = "SELECT * FROM ( select * from " . $this->config->item('table_name') . "
|
$sql = "SELECT * FROM ( select * from " . $this->config->item('table_name') . "
|
||||||
WHERE station_id IN(" . $location_list . ")
|
WHERE station_id IN(" . $location_list . ")
|
||||||
order by col_time_on desc, col_primary_key desc
|
order by col_time_on desc, col_primary_key desc
|
||||||
limit " . $num .
|
limit " . $num .
|
||||||
") hrd
|
") hrd
|
||||||
JOIN station_profile ON station_profile.station_id = hrd.station_id
|
LEFT JOIN station_profile ON station_profile.station_id = hrd.station_id
|
||||||
LEFT JOIN dxcc_entities ON hrd.col_dxcc = dxcc_entities.adif
|
LEFT JOIN dxcc_entities ON hrd.col_dxcc = dxcc_entities.adif
|
||||||
order by col_time_on desc, col_primary_key desc";
|
order by col_time_on desc, col_primary_key desc";
|
||||||
|
|
||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用