-1
For each pizza, display its count of rows in Stock
followed by all its columns in Product.  

库存表

   s_inv - Text - foreign key to Product
   s_num
   s_in_stock

产品表

 p_inv - Text - Primary Key
 p_name
 p_price
4

2 回答 2

0

更改您的代码并尝试此操作。

select p.p_inv,p.p_namep.p_price,count(select * from stock where s.s_inv=p.p_inv) from product p, stock s;
于 2013-10-23T04:03:42.160 回答
0

在 sql 服务器中:

select p.p_inv,
       p.p_name,
       p.p_price,
       s.s_num,
       s.s_in_stock,
       count(select * from product p,stock s where p.p_inv=s.s_inv) 
as rows_count 
from product p 
join stock s on p.p_inv=s.s_inv 
order by p.s_inv;
于 2013-10-23T04:20:18.237 回答