Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
xdk1x
Starting Member
9 Posts |
Posted - 2004-07-06 : 04:31:06
|
| Hi!I've got a table with some coloums like this:T1, T2, Number, CodeThere are three possibilities for the Code-row (A,B,C). Now I want to count the elements in the Number-row with the same T1 and T2 for all Codes, e.g.T1___T2___Number____Total____A___B___C54___43____4711______12____8____3___1Hope anyone can help me!!!Thank youDaniel |
|
|
nfsoft
Starting Member
36 Posts |
Posted - 2004-07-06 : 04:50:47
|
| I'm confuse but...I asume you are taking - T1 and T2 as Constraints - Number as a select count(distinct Number) - A B C as the grouping agregationThat would be:SELECT count(distinct B.number) FROM yourTable A INNER JOIN yourTable B ON A.T1 = B.T1 AND A.T2 = B.T2GROUP BY A.a, A.b, A.c this is probably wrong but its a start.Nuno Ferreira |
 |
|
|
|
|
|