Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Joining 3 tables

Status
Not open for further replies.

csiwa28

Programmer
Apr 12, 2001
177
0
0
I am trying to join 3 tables and extract particular data from the new table created and I am having trouble.My three tables are:

1. Catalogs
Catalog_ID
Catalog_ProductID
Catalog_Reference
Catalog_Month
Catalog_Year
Catalog_CatalogTypeID

2. ProductModels
ProductModel_ProductID
ProductModel_Model

3. CatalogTypes
CatalogType_ID
CatalogType_Description

I am trying to first join the Catalog Table with the CatalogTypes Table by CatalogTypeID then join that with the ProductModels table by the ProductID.

"SELECT Catalogs.Catalog_Reference,Catalogs.Catalog_Month, Catalogs.Catalog_Year, ProductModels.ProductModel_Model, CatalogTypes.CatalogType_Description FROM ProductModels INNER JOIN (Catalogs INNER JOIN CatalogTypes ON Catalogs.Catalog_CatalogTypeID=CatalogTypes.CatalogType_ID) ON Catalogs.Catalog_ProductID=ProductModels.ProductModel_ProductID WHERE ProductModels.ProductModel_ProductID=" & Request.QueryString("ID")

It seems to work when take out the 'WHERE' part but when I leave it in, my page is left blank. What am I doing wrong?
 
Would this work?

"SELECT
Catalogs.Catalog_Reference,
Catalogs.Catalog_Month,
Catalogs.Catalog_Year,
ProductModels.ProductModel_Model,
CatalogTypes.CatalogType_Description

FROM ProductModels
INNER JOIN Catalogs ON Catalogs.Catalog_ProductID = ProductModels.ProductModel_ProductID
INNER JOIN CatalogTypes ON Catalogs.Catalog_CatalogTypeID = CatalogTypes.CatalogType_ID


WHERE ProductModels.ProductModel_ProductID = " & Request.QueryString("ID") gettin' jiggy wid' it --
smbure
 
I tried it but now I getting an error. Thanks though for your suggestion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top