How to remove duplicate elements in the array when unloading data from a table?

There is a table which has a column with the user ID that are repeated on some rows. As in the derivation of these data to remove duplicate items?
March 23rd 20 at 18:53
2 answers
March 23rd 20 at 18:55
Solution
Doing coursework, not paying attention to any documentation, thank you - brennon67 commented on March 23rd 20 at 18:58
March 23rd 20 at 18:57
the most simple and the first thing that came to mind - to push out the ID in the 2nd array to compare with the original array (data table), and if there are duplicate remove.
or is
banished to push ID into the 2nd array

Then get the extra array.

to compare with the original array (data table)

Then drag the extra data.

array_unique

Only if the sql fails to build the required query.

In most cases, this problem can be solved on the side of sql (distinct, group_by). - janie.Cart commented on March 23rd 20 at 19:00
@janie.Cart, but the problem is solved, isn't it?
the issue was the PHP tag. and did I mention that I wrote the first thing that came to mind. - jayde.Goodwin commented on March 23rd 20 at 19:03
@jayde.Goodwin, "nails with a microscope" score - janie.Cart commented on March 23rd 20 at 19:06
@janie.Cart, why not. it is a heavy, hammered nails well. Yes, and the first that got under a hand. laziness was in the garage to go for a hammer. - jayde.Goodwin commented on March 23rd 20 at 19:09

Find more questions by tags SQL