MySQL Forums
Forum List  »  Stored Procedures

Re: Compare 2 columns in database for not matching rows
Posted by: Peter Brawley
Date: December 23, 2005 12:57PM

Rows do not have instrinsic order, so to answer your question, I am assuming 'Row 1' means 'the row where company_ID=1', ie company_id is primary key in the company table, so your query would look like ....

SELECT company.company_Name, company.company_Id
FROM company
LEFT JOIN work USING (company_id)
WHERE work.company_id IS NULL;

which returns the 'company' rows that have no matching 'work' rows.

PB

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Compare 2 columns in database for not matching rows
2865
December 23, 2005 12:57PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.