MySQL Forums
Forum List  »  Other Migration

Re: Comparing two tables
Posted by: Natasha Hurley-Walker
Date: August 02, 2004 10:02AM

Hi Nick,

Thanks, I had a great weekend. And the Monday was all the better for your post; everything worked like a charm :) I have another element to add now, which may make the topic title slightly outdated:

I have another table of harmonics by which I want to multiply the Table2 Periods and compare the results to the Table 1 Periods. Table 3 has two columns, Harmonic and Multiplier, which are simply a varchar label and a 0 float =<3.

I can display all of the positive matches using:
SELECT Table1.Period, Table1.SNR, Table2.ID, Harmonics.Harmonic FROM Table1, Table2, Harmonics WHERE ABS(Table1.Period - (Table2.Period*Harmonics.Multiplier)) <= 0.01

But I would also like to display the full table without any of the matches. However I can't figure out where to put the Harmonics table when using the LEFT JOIN syntax. I have the feeling I need to create a temporary table like

------------------------------------------------------------------------------------------------------------------------
Table2.ID | Harmonics.Multiplier | Harmonics.Harmonic*Table2.Period
-------------------------------------------------------------------------------------------------------------------------

then compare the Table1.Period to the third column above, using the usual ABS syntax.

I'll be trying that for a bit; if there's an easier way let me know :)

Thanks a million,

Tash

Options: ReplyQuote


Subject
Views
Written By
Posted
18398
July 27, 2004 07:38AM
11068
July 28, 2004 04:01AM
5028
July 28, 2004 05:55AM
4642
July 28, 2004 07:26AM
3625
July 30, 2004 07:48AM
3315
July 30, 2004 09:00AM
3542
July 30, 2004 10:57AM
Re: Comparing two tables
3124
August 02, 2004 10:02AM
2925
August 02, 2004 10:22AM
3083
August 02, 2004 03:42PM
3098
August 03, 2004 04:10AM
3849
August 03, 2004 04:30AM


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.