title: Finding MAX column BigQuery SQL
body: <p>I am attempting to 'normalize' the data in a column so it ranges between 0 and 1. My initial plan was to find the MAX value of the column and perform the following calculation:
  column/MAX(column). The problem I am having is that the output looks like this</p>
  
  <p><a href="https://i.stack.imgur.com/xnIyz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xnIyz.png" alt="enter image description here"></a></p>
  
  <p>It goes on like that...</p>
  
  <p>Obviously it seems that my query is pulling the max of that particular row, which as it only has one value, matches said value and the normalized data is always one. </p>
  
  <p>Here is the query I used to find the pageviews (the data is from GA and the schema is unchanged from the default):</p>
  
  <pre><code>SELECT
    pageTitle, 
    COUNT(*) AS pageviews
  
  FROM (
    SELECT
       hits.page.pageTitle,
       hits.type,
  
      FROM
      `medicine-matter.131114627.ga_sessions_*` AS GA,
      UNNEST(GA.hits) AS hits
  
      WHERE
      type = 'PAGE'
  
       )
      GROUP BY
      pageTitle
  
      ORDER BY
      pageviewDESC
  </code></pre>
  
  <p>I am then calling the pageviews in another table like so:</p>
  
  <pre><code>SELECT
  pageviews,
  MAX(pageviews) as MAX,
  pageviews/ MAX(pageviews) as normal_pageview
  
  
  FROM
  `table`
  WHERE
  pageviews &gt; 1
  
  group by 
  pageTitle,
  pageviews
  
  ORDER BY
  normal_pageview DESC
  </code></pre>
  
  <p>I am very new to SQL so i can only apologies if i am doing something absolutely moronic.</p>