mysql从一个包含多外键的单元格中选择数据

rdrgkggo  于 2021-06-18  发布在  Mysql
关注(0)|答案(0)|浏览(276)

表名产品

+-----+-------------+-----------+----------+-----------+
| ID  | productCode | name      | quantity | SupplierID|
+-----+-------------+-----------+----------+-----------+
|  1  | PEN         | Pen Black |     2000 |    1, 5,  |
+-----+-------------+-----------+----------+-----------+
|  2  | BOOK        |  Red Man  |     270  |   2, 3, 5 |
+-----+-------------+-----------+----------+-----------+

表名供应商

+-----+-------------+----------------------------+--------------+----------+
|ID   | SupplierCode|             name           |  address     | approved |
+-----+-------------+----------------------------+--------------+----------+
| 1   | MAL         |Merit Accessories LTD.      |  Dhaka, BD   |     Y    |
+-----+-------------+-----------------+----------+--------------+----------+
| 2   | IOL         |Intelligent Publishers LTD. |  Dhaka, BD   |     Y    |
+-----+-------------+-----------------+----------+--------------+----------+
| 3   | CPL         |Crypt Publishers LTD.       |  Delhi, IN   |     Y    |
+-----+-------------+-----------------+----------+--------------+----------+
| 4   | IPH         |Iris Publishers House.      |  Dhaka, BD   |     N    |
+-----+-------------+-----------------+----------+--------------+----------+
| 5   | RAPL        |Rume Acc. & Pub's LTD.      |  Gazipur, BD |     Y    |
+-----+-------------+-----------------+----------+--------------+----------+

所以,现在我想像下面这样连接表products和表supplier,这样所有supplierid一列就可以显示结果中的所有供应商列表-
选择产品。*从产品
在products.supplierid=supplier.id上内部联接供应商;

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题