|
@@ -806,9 +806,12 @@ class AdminController extends Controller
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ //Query distinct clients who have points that contain specific substrings in the point.data
|
|
|
|
+
|
|
$qry = "
|
|
$qry = "
|
|
SELECT
|
|
SELECT
|
|
- DISTINCT p.client_id,
|
|
|
|
|
|
+ DISTINCT ON (p.client_id)
|
|
|
|
+ p.client_id,
|
|
p.id,
|
|
p.id,
|
|
p.uid,
|
|
p.uid,
|
|
c.uid as client_uid,
|
|
c.uid as client_uid,
|
|
@@ -830,10 +833,12 @@ class AdminController extends Controller
|
|
LEFT JOIN pro mcp on mcp.id = c.mcp_pro_id
|
|
LEFT JOIN pro mcp on mcp.id = c.mcp_pro_id
|
|
LEFT JOIN client_primary_coverage cover on cover.client_id = c.id
|
|
LEFT JOIN client_primary_coverage cover on cover.client_id = c.id
|
|
";
|
|
";
|
|
|
|
+
|
|
|
|
|
|
if($searchArrayStrings){
|
|
if($searchArrayStrings){
|
|
- $qry = $qry . "WHERE lower(p.data) ILIKE any (array[".$searchArrayStrings."])";
|
|
|
|
|
|
+ $qry = $qry . " WHERE lower(p.data) ILIKE any (array[".$searchArrayStrings."])";
|
|
}
|
|
}
|
|
|
|
+ $qry = $qry . " ORDER BY p.client_id DESC, p.created_at DESC";
|
|
|
|
|
|
$records = null;
|
|
$records = null;
|
|
|
|
|