views:

33

answers:

2

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,pcolor,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.

A: 
select a.pid, pname, pcolor, date_delivered, quantity 
    from products a, warehouse b 
    where a.pid = b.pid;
luckytaxi
these does not work either. :(
kester martinez
A: 
SELECT *
FROM product
INNER JOIN warehouse
ON product.pid = warehouse.pid

Here an Inner Join is used.

Gazler
he also needs the fields from the warehouse table.
luckytaxi
@luckytaxi - I suggest you look at how JOIN works in SQL.
Gazler
this is what I am looking for. thanks
kester martinez