I'm trying to display a list of all my records. For some reason, my join only seems to be pulling a single record though. I'm pulling the data off a table called inventory, which has numeric foreign keys to other tables. Those other tables have a mathching primary key and a corresponding description.
To be more clear, here is what a sample would look like...
assetID department building
12345 3 6
but the tables for department and building would look like this...
departmentID departmentDesc
1 accounting
2 human resources
3 mail room
So I would like my list of records to display the corresponding descriptions and not the numeric values. I've used two different ways so far, but both only give one record:
select inventory.assetID,
inventory.room,
model.modelDesc,
status.statusDesc,
category.categoryDesc,
department.departmentDesc,
location.locationDesc
from
inventory,
status,
category,
department,
model,
location
where
inventory.category = category.categoryID
and inventory.location = location.locationID
and inventory.department = department.departmentID
and inventory.model = model.modelID
and inventory.status = status.statusID;
which is essentially the same as
select inventory.assetID,
inventory.room,
model.modelDesc,
status.statusDesc,
category.categoryDesc,
department.departmentDesc,
location.locationDesc
from
inventory join status on inventory.status = status.statusID
join category on inventory.category = category.categoryID
join department on inventory.department = department.departmentID
join model on inventory.model = model.modelID
join location on inventory.location = location.locationID;