Divide Max of one column with value in current record

  • Thread starter Thread starter Tod
  • Start date Start date
T

Tod

I have a table with two columns. Each is a column of numbers, any
numbers. Like this:

Col1 Col2
1 8
2 4
4 4
3 7
7 1

For each record, I want to divide the value in Col1 with the MAXIMUM
value of Col2. In this example, each value in Col1 will be divided by
8.

How do I do this?

tod
 
Tod said:
I have a table with two columns. Each is a column of numbers, any
numbers. Like this:

Col1 Col2
1 8
2 4
4 4
3 7
7 1

For each record, I want to divide the value in Col1 with the MAXIMUM
value of Col2. In this example, each value in Col1 will be divided by
8.


You can use a subquery:

SELECT (SELECT Max(X.Col2) FROM table As X) As maxval,
T.Col1,
T.Col1 / maxval
FROM table As T
 
Back
Top