By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,943 Members | 1,875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,943 IT Pros & Developers. It's quick & easy.

Min of values in two columns

P: 1
Hello,
I want to obtain the max number of columns TEST1 and TEST2

Expand|Select|Wrap|Line Numbers
  1. NAME    TEST1      TEST2
  2. Joe    2    3
  3. Jane    3    1
  4. Bob    5    1
The outcome should look like this

Expand|Select|Wrap|Line Numbers
  1. NAME    TEST1      TEST2   MAX
  2. Joe    2    3            3
  3. Jane    3    1            3
  4. Bob    5    1            5
I can't seem to to get a MAX when combinig two columns, please help.

Thank you in advance!
Mar 9 '07 #1
Share this Question
Share on Google+
1 Reply


MSeda
Expert 100+
P: 159
Will an if statement not do?

Expand|Select|Wrap|Line Numbers
  1. SELECT Name, Test1, Test2, IIf([Test1]>[Test2],[Test1],[Test2]) AS [Max]
  2. FROM [Test Table];
Mar 9 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.