[wp-hackers] MySQL View of every posts in a WP network

Otto otto at ottodestruct.com
Wed Nov 23 13:53:47 UTC 2011


There is no such thing as a wildcard table specifier in SQL. So SELECT
* FROM wp_1_posts UNION ALL SELECT * FROM wp_2_posts UNION ALL SELECT
* FROM wp_3_posts... is the only way to do it.

Forget about it. Use PHP.

-Otto



On Wed, Nov 23, 2011 at 5:07 AM, Carlo Gandolfo <carlo at artilibere.com> wrote:
> Hello everybody,
> I got a WP network whose posts tables are named:
>
>> wp_1_posts
>> wp_2_posts
>> wp_3_posts
>> ...
>> wp_n_posts
>>
>
>
> and I wish to build a view in MySql to gather all the contents (with limit
> 20) in a single block.
> That could be very useful to query and filter without having to loop
> through php.
>
> Anybody has hints to do that?
>
> Thank a lot,
> Carlo
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list