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 |
GPSPOW
Starting Member
5 Posts |
Posted - 2013-01-06 : 13:17:01
|
I have a spreadsheet table derived from a SQL view. I perform an ARRAY function on the table where I determine the MAX value of a column of values based on the value in another row column:{MAX(IF( lookuprange=cellvalue,rangevalues ))}How can write a SQL statement to emulate this function in the original view?Glen |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2013-01-06 : 15:11:49
|
Not really enough to go on here, but something like MAX(CASE WHEN COL1 IN (Val1,Val2, etc.) THEN COL2 ELSE someOtherValue END)JimEveryday I learn something that somebody else already knew |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2013-01-07 : 07:47:41
|
If you use version 2012, you can use IIF function in the same way used in EXCELMadhivananFailing to plan is Planning to fail |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-01-07 : 09:33:48
|
the lookuprange can only be simulated by join in t-sql.then you can use something like jimf showed or using IIF if sql 2012------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|