mirror of https://github.com/itflow-org/itflow
Fix clients being duplicated when multiple tags are assigned to them
This commit is contained in:
parent
5640a22c18
commit
cdf97ec83b
|
|
@ -11,7 +11,7 @@ $url_query_strings_sb = http_build_query(array_merge($_GET, array('sb' => $sb, '
|
||||||
|
|
||||||
$sql = mysqli_query(
|
$sql = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT DISTINCT SQL_CALC_FOUND_ROWS clients.*, contacts.*, locations.*, tags.* FROM clients
|
"SELECT DISTINCT SQL_CALC_FOUND_ROWS * FROM clients
|
||||||
LEFT JOIN contacts ON clients.primary_contact = contacts.contact_id AND contact_archived_at IS NULL
|
LEFT JOIN contacts ON clients.primary_contact = contacts.contact_id AND contact_archived_at IS NULL
|
||||||
LEFT JOIN locations ON clients.primary_location = locations.location_id AND location_archived_at IS NULL
|
LEFT JOIN locations ON clients.primary_location = locations.location_id AND location_archived_at IS NULL
|
||||||
LEFT JOIN client_tags ON client_tags.client_tag_client_id = clients.client_id
|
LEFT JOIN client_tags ON client_tags.client_tag_client_id = clients.client_id
|
||||||
|
|
@ -21,7 +21,7 @@ $sql = mysqli_query(
|
||||||
AND client_archived_at IS NULL
|
AND client_archived_at IS NULL
|
||||||
AND DATE(client_created_at) BETWEEN '$dtf' AND '$dtt'
|
AND DATE(client_created_at) BETWEEN '$dtf' AND '$dtt'
|
||||||
AND clients.company_id = $session_company_id
|
AND clients.company_id = $session_company_id
|
||||||
GROUP BY clients.client_id, contacts.contact_id, locations.location_id, client_tags.client_tag_tag_id, tags.tag_id
|
GROUP BY clients.client_id
|
||||||
ORDER BY $sb $o LIMIT $record_from, $record_to
|
ORDER BY $sb $o LIMIT $record_from, $record_to
|
||||||
");
|
");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue