mirror of
https://github.com/itflow-org/itflow
synced 2026-03-20 04:34:51 +00:00
Use a WAY MORE Efficient query when filling out filter selection boxes by using EXIST instead of DISTINCT selections
This commit is contained in:
@@ -118,10 +118,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$sql_locations_filter = mysqli_query($mysqli, "
|
||||
SELECT DISTINCT location_id, location_name
|
||||
FROM locations
|
||||
LEFT JOIN networks ON network_location_id = location_id
|
||||
WHERE location_client_id = $client_id
|
||||
AND location_archived_at IS NULL
|
||||
AND (network_location_id != 0 OR location_id = $location_filter)
|
||||
AND ( EXISTS (SELECT 1 FROM networks WHERE network_location_id = location_id AND $archive_query) OR location_id = $location_filter)
|
||||
ORDER BY location_name ASC
|
||||
");
|
||||
while ($row = mysqli_fetch_array($sql_locations_filter)) {
|
||||
|
||||
Reference in New Issue
Block a user