简体   繁体   中英

select query to display data from multiple table in different rows with in same html table

I have two tables.First table having two columns id and birds. Second table has two columns id and animals name. How to fetch this record using mysql and display it in a html single table in different rows.

鸟表

动物桌

输出表

You can do as

select 
@r:=@r+1 as id , 
resultdata from 
(
  select birds as resultdata from birds 
  union all 
  select animals as resultdata from animals
)x,(select @r:=0)n;

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