S
S
sandrain2014-06-12 10:47:42
MySQL
sandrain, 2014-06-12 10:47:42

How to create a selection for an activity feed in MySQL?

Gentlemen, next question.
There are 5 tables, you need to collect information about them together and sort by date.
The problem comes when I join tables like this:

SELECT l . * , f . * 
FROM user t
INNER JOIN likes l ON t.id = l.author
INNER JOIN follow f ON t.id = user_id
WHERE t.id =5
LIMIT 0 , 30

Result:
MEGTFMK.png
Cells are repeated. Somehow you can get rid of repetitions and bring it to the form - one cell - one event?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Vershinin, 2014-06-12
@WolfdalE

So why do you have INNER at the top and LEFT at the bottom? Use INNER.

F
Facetrollex, 2014-06-12
@Facetrollex

If columns are duplicated, then select only the ones you need, and not
In order not to duplicate lines, first do a JOIN instead of Left Join, if there are duplicates anyway, then look for the difference in these lines (it should be, and I suspect that you have jambs with dates there)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question