sql server 2008 - How to create group by function for firstname,mark1,mark2,mark3? -
i have merged 3 tables using union query , created group id already.
here code:
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 what question able create group function rest of columns without using join query?
thanks in advance.
 
 
Comments
Post a Comment