i****a 发帖数: 36252 | 1 So there is a table where ColA and ColB combined is the primary key
How do I do a GROUP BY on the combined key?
obviously GROUP BY ColA, ColB is not correct. |
B*****g 发帖数: 34098 | 2 why not?
【在 i****a 的大作中提到】 : So there is a table where ColA and ColB combined is the primary key : How do I do a GROUP BY on the combined key? : obviously GROUP BY ColA, ColB is not correct.
|
i****a 发帖数: 36252 | 3 Initilly I thought that's how it should work but some rows are being
excluded incorrectly.
[发表自未名空间手机版 - m.mitbbs.com]
【在 B*****g 的大作中提到】 : why not?
|
z**********8 发帖数: 2049 | 4 你这个group的目的是啥?是要aggregating吗? 还是只是要list好看点?如果是前者
,你group by primary key(s)的RESULT,有点奇怪了。
根据syntax,好像multilevel的GROUP就是group by col1,col2. |
s**********o 发帖数: 14359 | 5 Yes, A-B is key, why group by, unless they should be key, but they are not
you are loooking fof dup keys. |
s**********o 发帖数: 14359 | 6 how about Group by convert(varchar, a)+convert(varchar, b) |
B*****g 发帖数: 34098 | 7 这个肯定不行,ab+c和a+bc会搞到一块去
【在 s**********o 的大作中提到】 : how about Group by convert(varchar, a)+convert(varchar, b)
|