You are here: Re: Having trouble with left join « PHP Programming Language « IT news, forums, messages
Re: Having trouble with left join

Posted by chadlupkes on 03/28/07 06:12

Hi Jerry,

Please see my other post for the PHP code. I've been busy today and
couldn't get to my system until now.

I think it's something to do with my PHP code, because when I run the
SQL query within mysql, it works exactly how I want it to. I think
I'm doing something wrong in the code, but I just can't see it.

Thanks!

Chad

On Mar 27, 7:01 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> chadlupkes wrote:
> > I'm getting NULLs where there shouldn't be. Any help is appreciated.
>
> > Here are the tables:
>
> > precinct
>
> > Field Type Null Key Default Extra
> > id smallint(6) PRI NULL auto_increment
> > precinct_number int(11) 0
> > precinct_name varchar(20) MUL
> > countydist smallint(6) 0
> > congdist smallint(6) 0
> > legdist smallint(6) 0
>
> > "precinct_name" is the name of the precinct, not the PCO. That's in
> > the next table.
>
> > pcolist
> > Field Type Null Key Default Extra
> > id smallint(6) PRI NULL auto_increment
> > precinct int(11) 0
> > pctname varchar(15)
> > area varchar(4)
> > legdist smallint(6) 0
> > countydist smallint(6) 0
> > congdist smallint(6) 0
> > name varchar(50)
> > email varchar(50) MUL
> > private tinyint(1) 0
> > type varchar(5)
>
> > I know there are some duplicates here, which is what I'm trying to
> > solve by this join statement:
>
> > SELECT king_precinct.precinct_number AS precinct_number,
> > king_precinct.precinct_name AS precinct_name, king_precinct.legdist AS
> > legdist, king_precinct.countydist AS countydist,
> > king_precinct.congdist AS congdist, pcolist.name AS name, pcolist.type
> > AS type
> > FROM king_precinct LEFT JOIN pcolist
> > ON king_precinct.precinct_number = pcolist.precinct
> > ORDER BY precinct_name
>
> > The problem is that it's not bringing up the name of the PCO in the
> > final result. Can anyone see what I'm doing wrong within the SQL
> > statement? If not, I can post the code I'm using.
>
> > Chad Lupkes
> > Seattle
>
> Chad,
>
> I don't see a PHP question here. In fact, I don't see any PHP here at all.
>
> Maybe you should be asking in a newsgroup related to your database?
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация