title: PostgreSQL-Error in 'yyyy;-Value should be integer
body: <p>I wrote the following commands on PostgreSQL:</p>
  
  <pre><code>create table Daily_Winners as (
      select d.* from 
      (
          select row_number() over(partition by "request_date",
                                                "revised_circle" 
                                   order by "earned_score" desc,
                                            "count_of_attempts" asc) rn,
                  * 
          from 
          (
              select a.*,b.count_of_attempts, last_que_attempt 
              from
              (
                  select msisdn, revised_circle, 
                         to_date(left(a.request_date,10),'yyyy-mm-dd')request_date,
                         sum(cast(score as numeric(10,0))) Earned_Score 
                  from Airtel_season13_circles_final a  
                  where upper(a.ans_type)='CA' 
                  group by Revised_Circle, 
                           to_date(left(a.request_date,10),'yyyy-mm-dd'),
                           msisdn
              )a 
              join 
              (
                  select distinct revised_circle, 
                         to_date(left(a.request_date,10),'yyyy-mm-dd')request_date,
                         msisdn,
                         count(distinct transaction_id) count_of_attempts, 
                         max(to_timestamp(request_date, 'YYYY-MM-DD HH24:MI:SS')::timestamp without time zone)last_que_attempt 
                  from Airtel_season13_circles_final a 
                  group by revised_circle, 
                           to_date(left(a.request_date,10),'yyyy-mm-dd'),
                           msisdn
              )b 
              on a.msisdn=b.msisdn and a.revised_circle=b.revised_circle
              and a.request_date=b.request_date
          )c
      )d 
       where d.rn&lt;=20)
  </code></pre>
  
  <p>The execution of this gave me the following error:</p>
  
  <blockquote>
    <p>ERROR:  invalid value "requ" for "yyyy"<br>
    DETAIL:  Value must be an
    integer.</p>
  </blockquote>
  
  <p>Can anyone please help with this? Any suggestions will be appreciated. Thank you.</p>