title: ORACLE SQL issue
body: <p>I have requirement like in address table I have address of many people stored but the address of a particular person can change.but address table is insert only.Every time address of a particular person changes we insert a new row and change the address in that row and we have one common_id column in the table which tells for which person this address got changed.So for each change in particular row the new row is added having same common_id as original initial row.I wrote the query for getting the latest address(finding by time_created) whose status is N and type L for all the people.But it is failing</p>
  
  <pre><code>select *
  from address wi
  where type = 'L'
    and status = 'N'
    and time_created = (
      select time_created
      from (
        select *
        from address w1
        where wi.common_id = w1.common_id
        order by time_created desc
        ) t
      where rownum = 1
      )
  </code></pre>
  
  <p>the above query is failing but when I am writing below query it is passing and giving the expected result</p>
  
  <pre><code>select *
  from address wi
  where type = 'L'
    and status = 'N'
    and time_created = (
      select max(time_created)
      from address t
      where t.common_id = wi.common_id
      )
  </code></pre>
  
  <p>the above query is passing and giving the expected result.</p>
  
  <p>I am amazed why why previous query is failing giving ora-00904 invalid identifier wi.common_id.Kindly help in understanding.</p>