mysql - 如何在 mysql 中索引(或查看)两个表?

标签 mysql sql join indexing view

aid  |  name                   udi | aid | name | description
------------------------      -------------------------
1       text                   1     1      text     text

我想将这些表合并到一个表中(实时更新)

我怎样才能使用这样的索引:

aid | aname |  uid | uname | udescription

最佳答案

Create view YOURviewName as   

select
a.aid,
a.name as aname,
u.aid as uid,
u.name as uname,
u.description as udescription
from
a inner join u on a.aid = u.aid

关于mysql - 如何在 mysql 中索引(或查看)两个表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34383943/

相关文章:

sql - 执行表更改脚本删除 Azure SQL 表

带有逗号分隔结果集的sql server子查询

sql - 如何创建一个表示字段不等于 X 的联接?

mysql - 我可以在 GROUP BY 和 ORDER BY 上强制使用 2 个单独的索引吗?

php - 返回 PHP 数组中每个日期的报告

mysql - 选择当前日期之前的日期 - mysql

php - MySQL 将表与结果中的原始信息连接起来

Mysql replace() 函数,帮助查询(我要转义哪些字符?)

python - 如何从多个表中检索数据

sql - PostgreSQL 数据库链接 : No function matches the given name and argument types