简体   繁体   English

选择查询以在同一html表的不同行中显示来自多个表的数据

[英]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. 我有两个表。第一个表有两列id和bird。 Second table has two columns id and animals name. 第二个表有两列id和动物名。 How to fetch this record using mysql and display it in a html single table in different rows. 如何使用mysql获取此记录并在不同行的html单个表中显示它。

鸟表

动物桌

输出表

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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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