sql - I want to use group by function for Id,Firstname,Mark1,Mark2,Mark3 -
i have 3 tables contains parent,child,mark
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)
by using query,i'm getting result.
select id, max(firstname)firstname, max(mark1) mark1, max(mark2) mark2, max(mark3) 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
here in query, have used group function id wanna use group function rest of column names. possible without using join query?
thanks in advance.
Comments
Post a Comment