我有多个表如下:MySQL查询,以避免重复结果
表1:产品
+-----+----------+--------+---------------------+
| id | biz_id | name | message |
+-----+----------+--------+---------------------+
| 1 | 1 | test1 | One tow three |
| 2 | 1 | test1 | One tow three |
| 3 | 1 | test1 | One tow three |
| 4 | 2 | test2 | hello world |
| 5 | 2 | test2 | hello world |
+-----+----------+--------+---------------------+
表2:图片
+-----+----------+--------------+-------------------+
| id | biz_id | product_id | path |
+-----+----------+--------------+-------------------+
| 1 | 1 | 1 | img/qwert1.jpg |
| 2 | 1 | 2 | img/qwert2.jpg |
| 3 | 1 | 3 | img/qwert3.jpg |
| 4 | 2 | 4 | img/qwery4.jpg |
| 5 | 2 | 5 | img/qwert5.jpg |
+-----+----------+--------------+-------------------+
如何避免在连接多个表时在mysql中重复?
我的查询是加入这两个表,以便我想避免重复的产品(获取Distint产品的名称)并获取与该产品相关的所有图像(例如Product> name - test1 has images qwert1.jpg,qwert2.jpg ,qwert2.jpg)
将所期望的结果是什么样的? – Strawberry