sql server - I have created 3 tables which contains parent,child,marks -
in parent table:
id int(primarykey), firstname varchar(50), email varchar(50)
in child table:
mid int(primarykey), mark1 int, mark2 int, id int(foreignkey)
in mark table:
uid int(primarykey), mark3 int, id int(foreignkey)
i'm using query:
select id,firstname,mark1,mark2,mark3 (select id,firstname,null mark1,null mark2,null mark3 parent union select id,null firstname,mark1,mark2,null mark3 child union select id,null firstname,null mark1,null mark2,mark3 mark)t group id,firstname,mark1,mark2,mark3
but if make group function using id,firstname,mark1,mark2,mark3 , i'm getting results this
so need result possible do?
just replace union union all.
select id,firstname,null mark1,null mark2,null mark3 parent union select id,null firstname,mark1,mark2,null mark3 child union select id,null firstname,null mark1,null mark2,mark3 mark
Comments
Post a Comment