简体   繁体   中英

Get mysql data from two tables

I have two tables like this:

Table 1

ID | COST |
1  | 601  |

Table 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

 select  cost
 from  table1 
 union all  
 select cost 
 from table2 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM