Jump to content

Query Help


nick2price

Recommended Posts

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?

Link to comment
Share on other sites

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';

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.