|
Posted by chadlupkes on 03/27/07 14:22
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
Navigation:
[Reply to this message]
|