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 |
|
srotondi
Starting Member
1 Post |
Posted - 2005-04-26 : 11:52:53
|
| I have used the median function that I received from one of the posts here, but now I need to group it by state.SELECT x.LN_CURR_PRINCIPAL AS medianFROM test.SUELIB x, test.SUELIB yGROUP BY x.LN_CURR_PRINCIPALHAVING (SUM({ fn SIGN(x.LN_CURR_PRINCIPAL - y.LN_CURR_PRINCIPAL) }) IN (1, 0))I need to group by the state field. So I would want one median value to be returned for each state. When I put in the x.STATE in the group by I recieve all the loan records by state not just one median value for each state?Any help is appreciated. P.S. I am still new to T-SQL. Thanks for your help. |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2005-04-26 : 16:09:46
|
| Did you also put x.STATE in the SELECT field list?---------------------------EmeraldCityDomains.com |
 |
|
|
|
|
|