I have three tables which contains parent,child,mark
In parent table:
Id int(primarykey),
Firstname varchar(50),
Email varchar(50)
In the Child Table:
Mid int(primarykey),
Mark1 int,
Mark2 int,
Id int(foreignkey)
In the Mark Table:
Uid int(primarykey),
Mark3 int,
Id int(foreignkey)
By using this query,I'm getting result.
select Id,
MAX(Firstname)Firstname,
MAX(Mark1) Mark1,
MAX(Mark2) Mark2,
MAX(Mark3) Mark3
from
(
select Id,Firstname,Null as Mark1,Null as Mark2,Null as Mark3 from Parent
union
select Id,Null as Firstname,Mark1,Mark2,Null as Mark3 from Child
union
select Id,Null as Firstname,Null as Mark1,Null as Mark2,Mark3 from Mark
) t
group by Id
Here in this query, I have used group by function for Id but I wanna use group by function for rest of the column names. So is that possible to do without using join query?
Thanks in advance.