mirror of
https://github.com/pi-hole/web.git
synced 2026-04-24 02:39:25 +01:00
Use JOIN instead of nested SELECT
Signed-off-by: DL6ER <dl6er@dl6er.de> Co-authored-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
@@ -521,7 +521,7 @@ if ($_POST['action'] == 'get_groups') {
|
||||
$delete_stmt = null;
|
||||
if($_POST['action'] == 'replace_domain') {
|
||||
// Check statement will reveal any group associations for a given (domain,type) which do NOT belong to the default group
|
||||
$check_stmt = $db->prepare('SELECT EXISTS(SELECT * FROM domainlist_by_group WHERE domainlist_id = (SELECT id FROM domainlist WHERE domain = :domain) AND group_id != 0)');
|
||||
$check_stmt = $db->prepare('SELECT EXISTS(SELECT domain FROM domainlist_by_group dlbg JOIN domainlist dl on dlbg.domainlist_id = dl.id WHERE dl.domain = :domain AND dlbg.group_id != 0)');
|
||||
if (!$check_stmt) {
|
||||
throw new Exception('While preparing check statement: ' . $db->lastErrorMsg());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user