Skip to content

Instantly share code, notes, and snippets.

@ejhayes
Created August 11, 2010 18:40
Show Gist options
  • Save ejhayes/519494 to your computer and use it in GitHub Desktop.
Save ejhayes/519494 to your computer and use it in GitHub Desktop.
select ncb.*
from
(select max(r_id) as r_id from ats.VW_NCB_QUARTERLY where cast(exec_date as DATETIME) between q2_start and q2_end group by ats) m
inner join ats.VW_NCB_QUARTERLY ncb
on m.r_id = ncb.r_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment