如何编写SQL以获得所需的结果

如何编写SQL以获得所需的结果

本文介绍了如何编写SQL以获得所需的结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi,

 i have table in db as below

deptId   deptName       9      10      11      13      groupName       A       G1       B       C      G2
------  --------       ---     ---     ---     ---     ----------     ----     ---      ---    ----    ---
8	Doctors 	2      	2       0       0       Permanent       0       1       0       0       1
8	Doctors 	2       2       0       0       Apprentice	0	0	0	0	1

have any ways to get the table as below

                                                                            Permanent                                 Apprentice
                                                                           -------------                              -----------
deptId   deptName       9      10      11      13      groupName       A       G1       B       C      G2       A      G1       B       C      G2
------  --------       ---     ---     ---     ---     ----------     ----     ---      ---    ----    ---     --      --       --      --     --
8	Doctors 	2      	2       0       0       Permanent       0       1       0       0       1      	0	0	0	0	1


where A,G1,B,C,G2 are the shift in permanent group in a department.

Thanks..

推荐答案


这篇关于如何编写SQL以获得所需的结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 08:23