MySQL Forums
Forum List  »  Stored Procedures

Compare 2 columns in database for not matching rows
Posted by: Aldrick
Date: December 11, 2005 02:01AM

Hi all,

Need some help here.

I am trying to compare 2 columns from 2 tables for non-matching rows. What is I meant is illustrated below.

Table 1:
Row 1 - 2
Row 2 - 3
Row 3 - 4

Table 2:
Row 1 - 2
Row 2 - 3

By comparing existing records of Table 1 and Table 2, I should be able to extract Row 3 out from Table 1 as it is not matching.

Here's the command I used:
CREATE PROCEDURE mysql_biosys.get_Company_Name(site_Id_Parsed INT)
BEGIN
SELECT company.company_Name, company.company_Id
FROM company, work
WHERE company.company_id != work.company_id
AND work.site_Id = site_Id_Parsed
AND company.company_Id != 1
GROUP BY company.company_Id;
END;
|

Please advice. Thanks in advance.

regards,
Aldrick

Options: ReplyQuote


Subject
Views
Written By
Posted
Compare 2 columns in database for not matching rows
7680
December 11, 2005 02:01AM


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.