title: What does select 1 do?
body: <p>I have some code and wanted to make it a learning experience. I would like to ask what a select 1 does?</p>
  
  <p>The first 5 lines look like someone is using a calendar function to get the yr, fiscal quarter, fiscal week then extract records if they exist in a table. I am not sure about what you would get other than you would get the yr, quarter, and week information and a column of 1's where the select 1 inner query found something. Could someone please help me with my interpretation of what is being returned? Thank you in advance. Oh, i should note that the calendar function is probably being used to truncate extra data that is returned from using the calendar function. Someone probably just wants something like June 1, 2016 rather then the minutes and seconds displayed.</p>
  
  <p>Here is the code snippet:</p>
  
  <pre><code>select calendar, fiscal_yr, fiscal_qtr, fiscal_week from dim_date_weeks
  Where exists (select 1 from dim_date cw
      where cw.calendar_date_Dateadd(dd, datediff(dd, 0, getdate()), 0)
      and weeks.fin_qtr=cq.fin_qtr
          and weeks.fiscalweek= cw.fiscal_week
      )
  union
  select dlw.calendar_date, dlw.fiscalyr, dlw.fin_qtr,fiscal_week from dim_date dlw join
  (select top 1 lw.fiscal_yr, lw.fin_qtr, fiscal_week from dim_date lw
      where lw.calendar=date &lt; (select min(calendar_date)from dim_date_weeks
                          where exists (select 1 from dim_date cw
                                  where date_Dateadd(dd, datediff(dd, 0, getdate()), 0)
                                  and weeks.fin_qtr=cq.fin_qtr
                                      and weeks.fiscalweek= cw.fiscal_week
                                  )
                          )
      order by lw.calendar_date desc
  </code></pre>