[英]Get mysql data from two tables
I have two tables like this: 我有两个这样的表:
Table 1 表格1
ID | COST |
1 | 601 |
Table 2 表2
ID | COST |
1 | 1000 |
I want to select data from this two tables. 我想从这两个表中选择数据。 How to do this?
这个怎么做? I want output like this
我想要像这样的输出
[
Table1 => [... data],
Table2 => [...data]
]
if you want the rows from both the tables you could use union all 如果你想要两个表中的行,你可以使用union all
select cost
from table1
union all
select cost
from table2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.