Re: Data Comparison

Rob Biedenharn
Fri, 08 Feb 2008 13:06:25 -0000

On Feb 7, 2008, at 9:04 PM, Jeff Miller wrote:

>
> Thank you very much for that detailed response! It clarified a lot for
> me. Sorry I didn''t include enough information... I am very new to
RoR
> and I haven''t used any kind of MVC type framework before. Both my
> models
> are empty (I don''t really know what I would put in them...) and
table1
> is called ''bes'' and table2 is called
''imports''. Everything seems to be
> working great! I tried to get the OUTER JOIN sql statement to work,
> but
> it actually gives me both matches and non-matches, instead of just
> non-matches. I know its not really a Ruby deal, but do you know the
> correct statement? I''ve been trying to look it up, but no luck so
far.
>
> @nonmatches = Bes.connection.select_all("SELECT bes.bes_phonenumber AS
> number, bes.bes_displayname AS name, imports.prov_service_number AS
> prov_number FROM bes LEFT OUTER JOIN imports ON bes.bes_phonenumber >
imports.prov_service_number

WHERE imports.prov_service_number IS NULL

> ")
>
>
> Thanks dude! I really appreciate your help!
> --


You need to select only those rows that exist in the result due to the
addition of the null record from the other table (because of the
OUTER).  It may not be something easily looked up, but it should be
easy enough to understand and apply later.

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org