mysql - obtener las últimas actividades de un usuario
Frecuentes
Visto 1,264 veces
1
This answer did work but with a problem. User recent activities - PHP MySql
My query is same as that
(SELECT `user_id`, `date_added`, 'vote' AS `type` FROM `vote` WHERE `user_id` = uid) UNION
(SELECT `user_id`, `date_added`, 'discussion' AS `type` FROM `discussion` WHERE `user_id` = uid) UNION
(SELECT `user_id`, `date_added`, 'comment' AS `type` FROM `comments` WHERE `user_id` = uid)
ORDER BY `date_added` DESC;
my tables are votes, comments, discussions. using this query, I cant get the newly inserted ones, but i get is last - 1 actvity. how do I take those in to those query?
2 Respuestas
1
You didn't provide a sample data point for us to look at but I think the problem could be that UNION is removing duplicates and your data points may be same across multiple tables? I'm just making a guess here based on the limited information.
I would suggest using Union ALL instead of UNION and see what data you get back. You can read more about Union and UNION All aquí
¡Gracias!
respondido 27 nov., 13:06
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas php mysql sql android-activity or haz tu propia pregunta.
can you clarify what you want to get exactly? - Sam
I cant get the newly inserted ones, but i get is last - 1 actvity - ZameerMoh