RE: [PHP-DB] Highlighting data selected from one table that appear in another
| From: | Murray @ PlanetThoughtful | Date: | Thu, 01 Sep 2005 15:57:08 +0000 |
| Subject: | RE: [PHP-DB] Highlighting data selected from one table that appear in another | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-40195@lists.php.net to get a copy of this message | ||
> mysql 4.0.25
> php 4.3.1
>
> I seem to be unable to solve this problem without some help.
>
> A webpage is to list all the clients in a mysql " Client" table. Each
> client has an an allocated clid.
>
> Those clients who are listed, identified by their allocated clid, in a
> "Transactions" are to be highlighted in different ways according to
> progress of the transaction, the progress being determined on whether
> date values have been inserted into various fields.
>
> Since mysql select joining the tables lists only the clients whose
> appear in both tables.
>
> I have been attempting to create a temporary table inserting the data
> from "Client" and "Transactions" and selecting from that but not
> successfully yet. But is this the way to go about it.
>
> The scale is an anticipated 1000 clients per month of which an
> anticipated 800 will involve transactions
>
> Louise
Hi Louise,
You should take a look at the LEFT JOIN syntax for SELECT statements.
http://dev.mysql.com/doc/mysql/en/join.html
Basically, you want 'all the results from table_a, and the relevant results
from table_b where table_a and table_b match.' You achieve this via using a
LEFT JOIN.
Regards,
Murray
---
"Lost in thought..."
http://www.planetthoughtful.org