I have one column called 'speeding' in a table containing many other columns. This column contains an integer that is foreign key to an entry on a table named Speeding. This table has columns 1-25 and an id that is referenced by the 'speeding' column from the first table.

我在一个包含许多其他列的表中有一个名为“speeding”的列。此列包含一个整数,该整数是名为Speeding的表上的条目的外键。此表包含第1-25列以及第一个表中“超速”列引用的ID。

Besides using join, is there any setting I can set on 'speeding' to make it automatically pull the associated data from the table Speeding?

除了使用join之外,是否有任何设置我可以设置'speeding'以使其自动从表Speeding中提取相关数据?

1 个解决方案

#1


0

You could create a view, a view is basically a SQL statement that is stored on the MySQL server and acts like a table

您可以创建一个视图,一个视图基本上是一个存储在MySQL服务器上的SQL语句,就像一个表

CREATE VIEW ViewName AS
SELECT tbl1.data, tbl2.speeding
FROM tbl1
INNER JOIN tbl2 ON tbl2.key = tbl1.key;

http://dev.mysql.com/doc/refman/5.0/en/create-view.html

You then use the view as you would use any table

然后,您可以像使用任何表一样使用视图

SELECT data, speeding
FROM ViewName

更多相关文章

  1. MySQL数据库8(二十)视图
  2. 如何知道php脚本中的名称是指mysql表还是mysql视图
  3. MySQL视图-(视图创建,修改,删除,查看,更新数据)
  4. 在平台上获取,可移植,更大和更快(无符号)的整数类型
  5. ng- repeat显示的行等于no属性,甚至不显示html视图上的数据
  6. 桌面视图中的SlikNav多级菜单?
  7. 在单选按钮上选中/取消选中,加载/隐藏部分视图
  8. 如何在当前视图中始终保持水平底部滚动条
  9. 切换元素类并使用旧类在视图中添加新元素

随机推荐

  1. Android Studio启动安卓虚拟机失败,附Andr
  2. Android按钮美化
  3. 安卓XML布局,相对布局的常用属性~
  4. android 自带的主题 theme 的使用
  5. 【eoeAndroid社区索引】android 条形码的
  6. android 之 install Location
  7. java解析json字符串的两种方法详解(Andro
  8. Android 输入限制
  9. 非一般的原因:Unable instantiate applica
  10. 实现Android简单动画旋转案例