SQL odd query

I'm inheriting some sql from a previous developer and I came across something that I haven't seen before and i was wondering if there is some logic here that I'm not aware of:

My concern is on the @yr variable that is being multiplied by 4. The value being passed in is a typical 4 digit year (2010, 2011 ect). Any ideas as to why this date would be multiplied?

SELECT DISTINCT yr, 
                          qtr, 
                          qratenat, 
                          obmediannat, 
                          measnum 
          FROM   dbo.globalresults 
          WHERE  numofmns = @NumOfMns 
                 AND ( yr * 4 + qtr ) IN (SELECT MAX(yr * 4 + qtr) 
                                          FROM   dbo.globalresults 
                                          WHERE  numofmns = @NumOfMns 
                                                 AND NOT ( qratenat IS NULL 
                                                           AND obmediannat IS 
                                                               NULL 
                                                         ) 
                                                 AND ( yr * 4 + qtr ) <= 
                                                     ( @Yr * 4 + @Qtr )) 

Open in new window

jgoodaleAsked:
Who is Participating?
 
ralmadaCommented:
to get the total number of quarters. So 2010 will have 8040 quarters.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.