Neil Tompkins wrote:
Hi,
I've the following table design (attached txt file, for some reason
the content was being blocked) and I'd like any advice if this is the
correct method/design.
TableName:ProductMaster
ProductMasterID
FriendlyProductName
TableName:ProductContent
ProductContentID
ProductName
Site
Language
TableName:ProductLookup
ProductLookupID
ProductContentID
TableName:Products
ProductsID
ProductSupplier
Cost
Below is my query extracting the data :
SELECT ProductName, ProductSupplier
FROM Products
INNER JOIN ProductLookup ON ProductMaster.ProductMasterID =
ProductLookup.ProductLookup
INNER JOIN Products ON ProductLookup.ProductID = Products.ProductsID
INNER JOIN ProductContent ON Products.ProductsID =
ProductContent.ProductContentID
WHERE ProductMaster.ProductMasterID = 1
AND ProductContent.Site = "mysite.com"
AND ProductContent.Language = "eng"
Neil, when making a query like this to the list, it would be helpful if
you explained the entities the various tables are dealing with and the
purpose for the query. This saves everyone a lot of time and guesswork.
I can spot two or three outright errors in your SQL statement, so
clearly you have not actually run it.
- You are referencing fields in one table that is not referenced.
- You reference another table twice.
- There is no field named ProductLookup.ProductLookup
Good luck with your homework!
- John