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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-02-02 : 07:25:42
|
| marmar writes "Hi I need help with a query. I have two tables that looks the same:table 1var1var2var3var4table 2var1var2var3var4What I want to do is group and order by var2, var3 and var4 and do a count(table1.var1)+ count(table2.var1)/2 (a mean) for the same groups. I'm not sure how to do this. Any suggestions ? Thanks in advance !" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-02-02 : 07:31:33
|
| Not sure what you want.select table1.var2, table1.var3, table1.var4 , (1.0 * count(table1.var1)+ count(table2.var1))/2from table1 join table2on table1.var2 = table2.var2 and table1.var3 = table2.var3 and table1.var4 = table2.var3group by table1.var2, table1.var3, table1.var4==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|