sql 右连接 return 多行从右 table

sql right join return multiple rows from right table

我有两个 tables 产品 table 和批次 table。 products table 包含产品列表,batch table 包含有关到货日期、到期日期、批号和数量的信息。当记录到批次 table 时,我拉取 product_id 并将其存储在批次 table 中。我想使用右连接查询两个 table,但是我无法从批处理 table 中获取其他行。这是我的代码

SELECT products.product_id, products.gen_name,products.product_code, batch.product_id FROM products RIGHT OUTER JOIN batch ON batch.product_id=products.product_id;

如何从批次table中获取到达日期、到期日期、批号和数量?

how can i also get arrival date, expiry date, batch number and quantity from the batch table?

将它们添加到 select 列表中。

没看到就不好说了table。我希望这可以帮助您解决问题: SQL RIGHT JOIN