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 |
|
saulfeliz
Starting Member
14 Posts |
Posted - 2012-06-26 : 20:48:28
|
| Dear SQL Gods,I have a gynourmous table (300 million+ rows) I need to query and get aggregate results. Some of these table’s variables looks like this: VAR1 VAR2 VAR3 VAR4 VAR5My task: count how many distinct times a unique combination of the data of VAR1 and VAR2 appear, rename it VAR1_2, when VAR5 is greater than 0. The query I’ve written looks like this:SELECT VAR1, VAR2, VAR3, VAR4, VAR5, COUNT (DISTINCT VAR1), COUNT (DISTINCT VAR2) AS VAR1_2 FROM Gynourmous_Table Where VAR5 > '0' GROUP BY VAR1, VAR2, VAR3, VAR4, VAR5ORDER BY VAR 1However, my result is an empty table, when I KNOW there should be data. Help? Thanks!Saul |
|
|
nathans
Aged Yak Warrior
938 Posts |
Posted - 2012-06-26 : 21:01:02
|
| Please show some sample data and desired results. |
 |
|
|
|
|
|
|
|