[SQL ] 资料结构不同的join问题

楼主: sleepwu ( )   2014-08-26 19:21:24
数据库名称:SQL server 2008
内容/问题描述:
因为不太好描述,我将table简化,请直接点连结看图。
我有两张table如http://tinyurl.com/pconsga
其中ABC栏都是string,A and B and C是key值,D E栏用来判断number2的属性。
我拿table2 right join table 2 on 1.A=2.A and 1.B=2.B and 1.C=2.C
结果因为key值重复,会显示为table3,但我想要呈现为table4的样子。
http://tinyurl.com/k4lssjz
请问这种资料结构该怎么join或是怎么group?
感谢!
作者: smlboby (波比)   2014-08-28 10:24:00
把 table3 当 subquery, 再包一层做 group by 也可以

Links booklink

Contact Us: admin [ a t ] ucptt.com