My apologies. I have edited the below into 2 table, Im just having a bit of confusion.
I have a tables very similar as the ones below and I wanted to show all the table2-class 1 but only 1 random item per each table1-category
Sample Item Table1
+---------+---------------+---------------+ | ID | Item Name | Category | +---------+---------------+---------------+ | 01 | Item A | Cat 1 | | 02 | Item B | Cat 1 | | 03 | Item C | Cat 2 | | 04 | Item D | Cat 2 | | 05 | Item E | Cat 3 | | 06 | Item F | Cat 3 | +---------+---------------+---------------+
Sample Item Table2
+---------------+---------------+ | Category | Class | +---------------+---------------+ | Cat 1 | 1 | | Cat 2 | 1 | | Cat 3 | 2 | +---------------+---------------+
I wanted to show all the table2-class 1 but only 1 random item per each table1-category
Desired Result
+---------+---------------+---------------+ | 02 | Item B | Cat 1 | | 03 | Item C | Cat 2 | +---------+---------------+---------------+
(This is within my PHP script)
Thanks in advance