Jump to content

Recommended Posts

Posted

If that happens again, can you run the following query and look for any duplicates under the `user_id` column?

SELECT `l1`.*
FROM `log_users` AS `l1`
INNER JOIN
(
SELECT `log_users`.*, MAX(`log_users`.`date_updated`) AS `date_logged`
FROM `log_users`
WHERE `log_users`.`result` = 'success'
GROUP BY `log_users`.`user_id`
) AS `online` ON `l1`.`user_id` = `online`.`user_id` AND `l1`.`date_updated` = `online`.`date_logged`
LEFT JOIN `staff` ON `staff`.`user_id` = `l1`.`user_id`
LEFT JOIN `clients` ON `clients`.`user_id` = `l1`.`user_id`
LEFT JOIN `contacts` ON `contacts`.`client_id` = `clients`.`id` AND `contacts`.`contact_type` = 'primary'
LEFT JOIN `contacts` AS `contacts2` ON `contacts2`.`user_id` = `l1`.`user_id`
WHERE `l1`.`company_id` = 1
ORDER BY `l1`.`date_updated` DESC
LIMIT 15;

Are there duplicates? Is the entire record duplicate (all fields identical) between those with the same `user_id`?

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...