Re: Appending query result sets?
| From: | Stuart | Date: | Sun, 08 Feb 2009 19:19:30 +0000 |
| Subject: | Re: Appending query result sets? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-287933@lists.php.net to get a copy of this message | ||
2009/2/8 Skip Evans <skip@bigskypenguin.com>:
> Is it possible to append a result query from one call to mysql_query() to
> the end of another if the specified fields are identical?
>
> Something like that would accomplish ths?
> $r1 = mysql_query('some sql');
> $r2 = mysql_query('some sql');
>
> $r3 = $r1.$r2;
>
> I suppose they could be read into an array then output that way, but I was
> hoping to more easily just append the result sets.
Best place to do this is in the SQL query with a UNION.
http://dev.mysql.com/doc/refman/5.0/en/union.html
-Stuart
--
http://stut.net/