MySQL Forums
Forum List  »  Other Migration

Comparing two tables
Posted by: Natasha Hurley-Walker
Date: July 27, 2004 07:38AM

Hi, I have a mySQL question:

Table1 has around 150k rows. One of the columns is made up of periods in float format whose values vary from 0.1 to 9000, and whose lengths vary from 4 to 9 (including the d.p.). Table2 has only 20 rows, 2 columns; one of its columns is an identifier and the other is made up of periods similar to those in the first table.

I want to compare the rounded (to 3 s.f.) value of the first table's period column with the value of the second table's period column, and display the first table with a column of identifiers (from the second table) indicating when a match is present. I have tried the syntax:

SELECT Table1.Period, Table2.Period, Table2.ID FROM Table1, Table2 WHERE ROUND(Table1.Period,3)=Table2.Period;

and with STRAIGHT_JOIN, but I always get an empty set.

Any ideas would be greatly appreciated.

Options: ReplyQuote


Subject
Views
Written By
Posted
Comparing two tables
18389
July 27, 2004 07:38AM
11061
July 28, 2004 04:01AM
5023
July 28, 2004 05:55AM
4637
July 28, 2004 07:26AM
3623
July 30, 2004 07:48AM
3309
July 30, 2004 09:00AM
3537
July 30, 2004 10:57AM
3119
August 02, 2004 10:02AM
2914
August 02, 2004 10:22AM
3076
August 02, 2004 03:42PM
3094
August 03, 2004 04:10AM
3844
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.