java - Get array of unique elements from Mysql -


i have such query:

select id, forum_theme, owner, enter_time, main_topic  forum_message  main_topic in (1,2,3) order enter_time desc limit 3  

array changing, , i'm adding in java, limit equals size of array. problem - need every record unique main_topic, each element of array must have 1 record, instead i'm having 1, 2, 2 topic records, etc.

how can change query maki possible?

try this:

select id, forum_theme, owner, enter_time, main_topic  forum_message  main_topic in (1,2,3) group main_topic order enter_time desc limit 3  

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -