[thelist] [mysql] join

Joshua Olson joshua at waetech.com
Wed Jan 28 13:38:14 CST 2004


From: "Tab Alleman" <Tab.Alleman at MetroGuide.com>
Sent: Wednesday, January 28, 2004 2:26 PM


> Which makes perfect sense; I just don't remember that being part of the
> original poster's request.  Her 3-query solution wouldn't have produced
> one row with both names from table_two, it would have produced a
> separate row for each name...wouldn't it?

> -----------------
> $sql_one = "select id_one, id_two, some_other_stuff from table_one where
> x";
> query
> fetch_rows
> $sql_two = "select name from table_two where id = id_one";
> $sql_three = "select name from table_two where id = id_two";
> -----------------

Her solution was the brute force way to collect the information into a
liquidable format.  Altogether I presented two queries to elegantly collect
the information in one request.  The first query I suggested put the
information into separate rows, and the second query (to which you
responded) was created after a request by her to put the related data in one
row.

<tip type="Clients" author="Joshua Olson">
Most clients appreciate it when you are willing to help them not shoot
themselves in the foot by restricting what they can and cannot do with their
websites.  Take enough time before you agree to work on the project to
determine if they are willing to work this way.  If you find that they way
to control everything, no matter how potentially damaging to the
presentation or validity of the website, then you may want to consider the
project a higher risk project.
</tip>

HTH,

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168




More information about the thelist mailing list