I have two tables as follows:
TABLE A TABLE B
StuID | actid FacID | actid
3 12 98 17
5
You can concatenate these two tables by using select
, from
and where
.
select * from table_a where actid = 17
union all
select * from table_b where actid = 17
You may (or may not) need to do something about the ids not being unique, such as
select 'Student', table_a.* from table_a where actid = 17
union all
select 'Faculty', table_b.* from table_b where actid = 17
You want UNION ALL:
(SELECT * FROM tablea) UNION ALL (SELECT * FROM tableb)
I think those parenthese are correct. I remember MySQL being fussy about this.
its too easy
select tableA.stuId,tableA.actId, tableB.facId,tableB.actId
from tableA,tableB
where tableA.actid=tableB.actid;`