我有多个查询,例如query1 =从学生限制1中选择StudentName;
query2 =从学生人数限制2中选择StudentAge;
我想要类似
类别值StudentName查询1结果StudentAge query2结果
只是为了说明您离一个好问题有多远,这是一个完全符合您的问题的答案,但可能完全是垃圾。
drop table if exists student;
drop table if exists t;
create table student(id int, studentname varchar(3), studentage int);
create table t(val varchar(4));
insert into student values
(1,'aaa',19),(2,'bbb',19),(3,'ccc',30),(5,'ddd',20);
insert into t
select * from
(
select StudentName from student limit 1
) a
union all
(
select StudentAge from student limit 2
) ;
select * from t;
+------+
| val |
+------+
| aaa |
| 19 |
| 19 |
+------+
3 rows in set (0.001 sec)