nick2price Posted April 8, 2008 Share Posted April 8, 2008 I am not sure how to mark my last thread as solved, so if comone tells me i can do this. Thanks to everyone who helped in my last problem, it was solved with the code SELECT DISTINCT S.EventNo, E.cno, C.CName FROM Hiring_Small_Items S INNER JOIN Hiring_Large_Items L ON S.EventNo = L.EventNo INNER JOIN Events E ON S.EventNo = E.EventNo INNER JOIN Customers C ON E.Cno = C.Cno ORDER BY S.EventNo Now i am trying to find other ways of querying. I have a table which i need to select several columns from. So i have done this; SELECT StockNo, Description, S_Size, SupplierNo FROM Stock WHERE S_Size='small'; Now I want to use the SupplierNo to get the SupplierName from the Supplier table. How would i follow up this code with simular code from the top to do this? Or would i need to take another approach? Quote Link to comment Share on other sites More sharing options...
AndyB Posted April 8, 2008 Share Posted April 8, 2008 I am not sure how to mark my last thread as solved, so if comone tells me i can do this. At the bottom of the page, you should see a link named 'TOPIC SOLVED'. One click does it. Quote Link to comment Share on other sites More sharing options...
nick2price Posted April 8, 2008 Author Share Posted April 8, 2008 Thats kool, any help on the sql query? Quote Link to comment Share on other sites More sharing options...
zenag Posted April 8, 2008 Share Posted April 8, 2008 have u assigned SupplierNo as foreign keys in Supplier table? Quote Link to comment Share on other sites More sharing options...
zenag Posted April 8, 2008 Share Posted April 8, 2008 IF U ASSIGNED SupplierNo AS FOREIGN KEY IN SUPPLIER TABLE .... u can do like..... SELECT Stock.StockNo, Stock.Description, Stock.S_Size, Stock.SupplierNo ,Supplier.SupplierName FROM Stock LEFTJOIN Supplier ON Stock.SupplierNo=Supplier.SupplierNo WHERE Stock.S_Size='small'; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.