Skip to content

Instantly share code, notes, and snippets.

@webnitros
Created September 7, 2019 15:03
Show Gist options
  • Select an option

  • Save webnitros/346d244f4d02bc45b50b18c7ed0d5bc1 to your computer and use it in GitHub Desktop.

Select an option

Save webnitros/346d244f4d02bc45b50b18c7ed0d5bc1 to your computer and use it in GitHub Desktop.
Поиск дублей в поле
$q = $modx->newQuery('msProductData');
$q->select('id,COUNT(article) as count,article');
$q->groupby('article');
$q->having('count > 1');
$q->prepare(); echo '<pre>'; print_r($q->toSQL()); die;
if ($q->prepare() && $q->stmt->execute()){
while ($row = $q->stmt->fetch(PDO::FETCH_ASSOC)) {
$rows[] = $row;
}
}
echo '<pre>';
print_r($rows); die;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment