Ok...
 
select ref.zipcodes.state as state, count(1) as count 
from
BIGTABLE,BIGTABLE2,BIGTABLE3,ref.zipcodes 
where tsb between $Start and $End
and bigtable1.zipcode=ref.zipcodes.zipcode 
and bigtable2.zipcode=ref.zipcodes.zipcode 
and bigtable3.zipcode=ref.zipcodes.zipcode 
group by state 
order by count DESC
limit 10

 
That should do it, right?
 
Regards,
Mike Hillyer
www.vbmysql.com
 

-----Original Message-----
From: Peter J. Milanese [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 02, 2003 12:23 PM
To: Mike Hillyer
Cc: [EMAIL PROTECTED]
Subject: RE: Suggestions on joins/merges



Apologies.. I left that out... 

The ambiguous column is 'zipcode'. it is common between all tables. 

P 



        "Mike Hillyer" <[EMAIL PROTECTED]> 


06/02/2003 01:38 PM 


        
        To:        "Peter J. Milanese" <[EMAIL PROTECTED]>,
<[EMAIL PROTECTED]> 
        cc:         
        Subject:        RE: Suggestions on joins/merges



What column is MySQL complaining about being ambiguous? Isn't it just a
matter of adding tablename. To the start of the guilty column?

Mike Hillyer
www.vbmysql.com


-----Original Message-----
From: Peter J. Milanese [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 02, 2003 11:25 AM
To: [EMAIL PROTECTED]
Subject: Suggestions on joins/merges


Greetings:

I have a series of large tables. 5+gb each.
They have identical structures.

Sample of the query I want to run:

select ref.zipcodes.state as state, count(1) as count from
BIGTABLE,BIGTABLE2,BIGTABLE3,ref.zipcodes where tsb between $Start and
$End
and zipcode=ref.zipcodes.zipcode group by state order by count DESC
limit
10

This query references a small table (ref.zipcodes), which is not the
same
structure. I, of course, run into ambiguity issues...


Any ideas around this? It has to be a dynamic, efficient solution...

Thanks

P



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]





Reply via email to