primary foreign key display in html table
ok here is it. i have two tables: products and warehouse
product table consist of (pid(primary),pname,pcolor) while my warehouse table has (pid(primary foreign key=> products table), date_delivered,quantity).
my question is can i display the warehouse table with pid,pname,pcol开发者_如何学编程or,date_delivered and quantity since my primary key in warehouse table is the pid from products table? can i use join with these? if so how?
thank you.
SELECT *
FROM product
INNER JOIN warehouse
ON product.pid = warehouse.pid
Here an Inner Join is used.
select a.pid, pname, pcolor, date_delivered, quantity
from products a, warehouse b
where a.pid = b.pid;
精彩评论