Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Example - I have a data that is row based. Fortunately each set I know the approx max & min values. If I do a query though of something like above X Or less Y, the values will still be on different rows.I could settle for one of the desired outcomes below to later calculate range or to directly do it. Ideas... ??? ThanksItemName Degreesitem1 35item1 3item1 -25item2 45item2 3item2 -25Desired outcomes either ItemName DegreesMin DegreesMaxitem1 -25 35item2 -25 45or better yet ItemName DegreesRangeitem1 60item2 40andrewcw
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts
Posted - 2011-04-28 : 17:36:27
Can you calculate it as:
select ItemName, min(Degrees) as DegreesMin, max(Degrees) as DegreesMax, max(Degrees)-min(Degrees) as DegreesRangefrom yourTablegroup by ItemName
Or, are you concerned about something more such as picking up only principal values?
andrewcw
Posting Yak Master
133 Posts
Posted - 2011-04-28 : 20:55:56
Oh that's excellent Exactly what was needed !Thank you !!!!andrewcw