I've a question to ask about mysql, I am creating a supplier page which requires list down all the suppliers details and their products (randomly choose 3 product for each supplier), so we have to join 2 tables together, one is suppliers, another one is products, may I know how to present them in single mysql statement?
table1 - suppliers
id corp_name product_count
---------------------------------------
AD0728 John Smith 187
AD0729 JayJay 1983
table2 - products
pid cid p_name quantity
---------------------------------------
1 AD0728 Body Shampoo 10
2 AD0728 glass 10
3 AD0728 pen 10
4 AD0728 pencil 10
5 AD0728 eraser 10
6 AD0728 speaker 10
7 AD0729 monitor 10
8 AD0729 keyboard 10
9 AD0729 mouse 10
10 AD0729 processor 10
11 AD0729 box 10
12 AD0729 sunglass 10
Output
id corp_name pid p_name quantity
----------------------------------------------------------------
AD0728 John Smith 1 Body Shampoo 10
AD0728 John Smith 2 glass 10
AD0728 John Smith 3 pen 10
AD0729 JayJay 10 processor 10
AD0729 JayJay 11 box 10
AD0729 JayJay 12 sunglass 10
Thanks everyone.