I think this is going to be pretty hard to explain - but i'll try and give as much detail as possible.
I need to rip specific items from two tables in a database, proberbly at the same time.
The tables are constructed as so :
sql table : store_items
sql table : store_inventory
now, I need to get all items from store_items where the item_type field is 'computer', so the following query should be fine ?:
SELECT * FROM store_items WHERE item_type = 'computer';
However, the store_items contains information, irionicly, about items.
record 1 :
item_id : 1
item_name : fred
item_type : computer
item_size : 3
etc, etc.
record 2 :
item_id : 2
item_name : barney
item_type : computer
item_size : 2
etc, etc.
record 3 :
item_id : 3
item_name : dynage
item_type : computer
item_size : 44
etc, etc.
The table : store_inventory contains information, about how many of each item, a user has. the store_inventory table looks somthing like this :
record 1 :
inventory_id : 66
inventory_item_owner : 2
inventory_item_id : 1
record 2 :
inventory_id : 13
inventory_item_owner : 2
inventory_item_id : 2
record 3 :
inventory_id : 99
inventory_item_owner : 2
inventory_item_id : 3
As you may see, the the inventory_item_id refurs to the item_store table.
I now need all the items where inventory_item_owner = 2, for example, so the query would look something like this :
SELECT * FROM store_inventory WHERE inventory_item_owner = 2;
but, I need the item_name that the inventory_id is refuring to.
Hope that makes sense.