Here's what I currently have that doesn't work:

----BEGIN QUOTE-----
        $sth=$dbh->prepare ("SELECT listing.id, pictures.thumb_1, description.mls,
listing.p_city, listing.p_state, listing.p_zip, description.price from
listing, description, pictures");
        $sth->execute()
        or bail_out("Can't get listings");
        print "<TABLE>";
        while (($id, $thumb, $mls, $p_city, $p_state, $p_zip, $price) =
$sth->fetchrow_array())
        {
        print "<TR><TD>";
        show_thumb($id);
        print
"</TD><TD><B>$mls</B></TD><TD><B>$csz</B></TD><TD><B>$price</B></TD></TR>";

-----END QUOTE-----

The four tables are listing, description, rooms, and pictures. Each has an
ID column that will be identical; however some will have null columns. I
need the information out of each table for any one ID number regardless if
the column contains info or not. Hope this is clear enough. I'm a beginner
at MySQL (and related stuff) so your suggestion of ODBC went totally over my
head ;-) Thanks!

=Dawn

-----Original Message-----
From: Ed Carp [mailto:[EMAIL PROTECTED]]
Sent: Sunday, June 10, 2001 5:32 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Using more than one table


Dawn H ([EMAIL PROTECTED]) writes:

> I have four tables, and I want to use bits of each one to display a list
on
> one page.  I tried listing what I wanted out of each, but it seems that if
> any one of the fields chosen is null, the whole row with that ID# is left
> out. I thought perhaps a LEFT JOIN but don't know how to make that work on
> four tables rather than just two.

Can you give us an example?

By the way, I use Access a lot to build and model complex queries - I use
linked tables via MyODBC, and I play with it until I get it right, then hack
Microsoft's idea of SQL until the syntax is right, then feed it to MySQL.
Works like a charm. :)

You might want to try the same thing with your query.
--
Ed Carp, N7EKG          [EMAIL PROTECTED]           214/986-5870 cell phone
http://www.pobox.com/~erc

I sometimes wonder if the American people deserve to be free - they seem
so unwilling to fight to preserve the few freedoms they have left.


---------------------------------------------------------------------
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

Reply via email to