Re: Help with SELECT and possible JOIN

2009-01-19 Thread Duane Hill
On Mon, 19 Jan 2009, Duane Hill wrote: I have two tables defined: CREATE TABLE `tga_body` ( `body_id` int(10) unsigned NOT NULL auto_increment, `blob_pos` mediumint(8) unsigned NOT NULL, `file_id` int(10) unsigned NOT NULL, `blob_id` int(10) unsigned NOT NULL, PRIMAR

Help with SELECT and possible JOIN

2009-01-19 Thread Duane Hill
I have two tables defined: CREATE TABLE `tga_body` ( `body_id` int(10) unsigned NOT NULL auto_increment, `blob_pos` mediumint(8) unsigned NOT NULL, `file_id` int(10) unsigned NOT NULL, `blob_id` int(10) unsigned NOT NULL, PRIMARY KEY USING BTREE (`body_id`),

Re: possible join

2005-05-11 Thread Peter Brawley
>Although correct, many people consider this bad style - the ON clause >of the JOIN should contain only the join condition(s). So it would be >better to say Yes indeed but here the 'zip' condition is in the join for the possibility that the constant zip condition could speed up the join. See S

Re: possible join

2005-05-11 Thread SGreen
news <[EMAIL PROTECTED]> wrote on 05/11/2005 09:09:36 AM: > In article <[EMAIL PROTECTED]>, > Peter Brawley <[EMAIL PROTECTED]> writes: > > > Scott, sorry, my mistake, > > SELECT price > > FROM fedex_zones z > > INNER JOIN fedex_rates r ON z.zone=r.zone AND z.zip=94947 > > WHERE r.weight

Re: possible join

2005-05-11 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Peter Brawley <[EMAIL PROTECTED]> writes: > Scott, sorry, my mistake, >   SELECT price >   FROM fedex_zones z >   INNER JOIN fedex_rates r ON z.zone=r.zone AND z.zip=94947 >   WHERE r.weight = 25; > PB Although correct, many people consider this bad style - the ON

Re: possible join

2005-05-11 Thread Peter Brawley
Scott, sorry, my mistake,   SELECT price   FROM fedex_zones z   INNER JOIN fedex_rates r ON z.zone=r.zone AND z.zip=94947   WHERE r.weight = 25; PB Scott Haneda wrote: on 5/10/05 8:29 PM, Peter Brawley at [EMAIL PROTECTED] wrote: Scott, ...In part, my t

Re: possible join

2005-05-10 Thread mfatene
Hi, >>> SELECT zone from fedex_zones where zip = 94947 >>> select price from fedex_rates where zone = '8' and weight = '25' your query should be : select price from fedex_rates, fedex_zones where fedex_zones.zip = 94947 and fedex_zones.zip = fedex_rates.zip and fedex_rates.weight = '2

Re: possible join

2005-05-10 Thread Scott Haneda
on 5/10/05 8:29 PM, Peter Brawley at [EMAIL PROTECTED] wrote: > Scott, > >> ...In part, my trouble is that I need to take the resuling zone from the >> first >> select and use that to determine the field name. > >> I can easily do this in my code in 2 selects, but was hoping to be able to >> get

Re: possible join

2005-05-10 Thread Peter Brawley
Scott, >...In part, my trouble is that I need to take the resuling zone from the first >select and use that to determine the field name. >I can easily do this in my code in 2 selects, but was hoping to be able to >get the price back in just one select, if possible... If you have control over

possible join

2005-05-10 Thread Scott Haneda
Getting a little stuck on this one: Table defs below: I have two tables, fedex_zones contains zip code to zone data, so for example, zip 94947 is in zone 8 select zone from fedex_zones where zip = '94947' > 8 Now, in the defex_rates table is how, based on weight, I can look up how much it will c