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`?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...