1

Right now this is my query:

SELECT * 
FROM tblChatMessage  
WHERE groupID IN (456, 789) 
LIMIT 20  

the limit needs to be in every part of the IN range (so 20 of the 456 and 20 of the 789). How can I do this? The range is variable to the case. It could be 2 or 100.

Joey Dossche
  • 141
  • 1
  • 8

1 Answers1

0
(SELECT * FROM tblChatMessage WHERE groupID = 456 LIMIT 20)
union all
(SELECT * FROM tblChatMessage WHERE groupID = 789 LIMIT 20)
juergen d
  • 201,996
  • 37
  • 293
  • 362