Hello.

Please start a new thread instead of replying to an existing one. Or
else, your message will be sorted with the original thread for people
with decent mail readers.

On Wed 2003-01-15 at 14:42:05 -0500, [EMAIL PROTECTED] wrote:
> How do you query the table that is the results of a query?

By a sub-query. Since MySQL supports sub-queries only since
version 4.1 (alpha), you have to work around this limitiation.

The general answer can be found in the manual:

  http://www.mysql.com/doc/en/ANSI_diff_Sub-selects.html

> Must you ask MySQL to...
> ...create a temporary table form the results of the first query
> ...then query that temporary table
> ...then delete the temp table when you are done?

That is one possible solution (also mentioned in the manual page I
cited). The third step optional if you use the TEMPORARY keyword with
the table, because it will be deleted automatically when the
conncetion is closed.

> (and if so how do you ask MySQL to create a temp table from the
> results of a query?)

See http://www.mysql.com/doc/en/example-Maximum-column-group-row.html,
which shows a work-around to a query which typically needs a
sub-select.

> Is there a better and faster way to do this with minimum burden on
> the web server with the db on it?

No. Btw, in the cases where you cannot rewrite a sub-select into a
join, most often an RDBMS will so the equivalent of a temporary
table. So there is not much loss, except for the additional transfer
and parsing of the queries.

HTH,

        Benjamin.

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

Reply via email to