Skip to content

Instantly share code, notes, and snippets.

@philihp
Last active December 31, 2015 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philihp/8023422 to your computer and use it in GitHub Desktop.
Save philihp/8023422 to your computer and use it in GitHub Desktop.
query for aaron
select c.name, m.serialnumber,
first_value(l.username) over (order by l.timestamp desc) as username
from machines m
inner join computersmachine cm on (m.id=cm.machineid)
inner join computers c on (cm.computerid=c.id)
left join logins l on (l.machineid=m.id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment