left join problem

2008-01-08 Thread Wes Hegge
I am attempting to left join several tables.  This was working at one time
but has seemed to stop just recently.  I have checked and installed the
lastest version of mysql via Debian Etch apt-get.  I am running version
5.0.32.

I have simplified the example down to just 3 tables but the problem exists
at this point.

Table 'contacts'  - Does not matter what the fields are, still the same
problem.  I am not using TEXT fields though.  Most are int's or varchar's
   account_num
   first_name
   last_name

Table 'address'
   account_num
   address_1
   address_2
   city
   state
   zip

Table 'phone'
   account_num
   phone_1
   phone_1_type
   phone_2
   phone_2_type

What I want to do is search all three tables for something, return anything
that matches.  So here is the select statement I have been using:
SELECT contacts.account_num, first_name, last_name, address_1, city_1,
phone_1 FROM contacts LEFT JOIN (address, phone) ON (contacts.account_num =
address.account_num AND contacts.account_num = phone.account_num) WHERE
contacts.account_num LIKE '%something%' OR contacts.first_name LIKE
'%something%' OR address.address_1 LIKE '%something%' OR
address.address_2LIKE '%something%' OR
address.city LIKE '%somehting%' OR phone.phone_1 LIKE '%something%' OR
phone.phone_2 LIKE '%something%' ORDER BY last_name;

When I run this query I only get data back from the 'contacts' table.  What
I have been able to track down is that if I am missing data from any of the
tables that I LEFT JOIN'd then all the data from all the LEFT JOIN'd tables
will be NULL.  In other words if I have account data in tables 'contacts'
and 'address' but nothing in 'phone' then no data from tables 'address' or
'phone' will be returned.  If I add data to 'phone' then data is returned
properly.

Is this correct behavior?  If so, any suggestions on how to solve this
problem would be great.  Realize this is a smaller example of what I am
really trying to do.  There are at least 4 tables in the select statement at
any one time and could be as many as 6.

Thanks!

-- 
Wes Hegge

- If the phone rings.  Its not me.
-- Jimmy  Buffet


RedHat 8.0 and MySQL 3.23.55 install problem

2003-02-11 Thread Wes Hegge
I am having problems installing MySQL 3.23.55 on RedHat 8.0.  The
version that came with RedHat will not let me remotely login.  I found a
thread at RedHat that said that this is a known problem. One of the
suggestions was to upgrade MySQL.  That is what I am attempting to do. 
This is what happens.

I have these files:
MySQL-3.23.55-1.i386.rpm
MySQL-bench-3.23.55-1.i386.rpm
MySQL-client-3.23.55-1.i386.rpm
MySQL-devel-3.23.55-1.i386.rpm
MySQL-shared-3.23.55-1.i386.rpm
I do this command to upgrade:
rpm -Uvh MySQL*
I get this message back:
Failed dependencies: 
MySQL-DBI-perl-bin is needed by MySQL-bench-3.23.55-1
I know I have this dependency installed, but I think I know where the
problem is just not sure how to fix it.  Here is what I get when I do a
'rpm -qa | grep DBI-perl':
Mysql-DBI-perl-bin-1.1825-1

I think the problem is in the name of the dependency, 'bench' is looking
for MySQL-DBI-perl-bin and I have Mysql-DBI-perl-bin installed - 'MySQL'
and 'Mysql' do not match so the dependency is failing.  AM I correct in
this?  If so how do I fix it?

Thanks for the help,

Wes Hegge
SignalBlast.com, Inc.
p: (815) 397-1700
e: [EMAIL PROTECTED]




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php