在mysql表名中使用通配符 [英] Use of wildcards in mysql table name

查看:253
本文介绍了在mysql表名中使用通配符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的mysql数据库中的表名是动态生成的.有什么方法可以从名称与模式匹配的表中选择数据?我想它会像这样:

The table names in my mysql database are dynamically generated. Is there some way to select data from tables which have a name matching a pattern? I guess it will look like:

select * from 'table_id_%'

推荐答案

不,您无法使用MySQL做到这一点.无法动态指定查询中的表-您必须在应用程序中构建列表(或执行多个单表查询).

No, you can't do that with MySQL. Tables in a query can't be dynamically specified - you have to build the list in your application (or do several single-table queries).

这篇关于在mysql表名中使用通配符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆