Skip to content

Instantly share code, notes, and snippets.

@ofelix03
Last active November 4, 2022 13:08
Show Gist options
  • Select an option

  • Save ofelix03/971bb5b715ab13877ca3ec0a79b9b952 to your computer and use it in GitHub Desktop.

Select an option

Save ofelix03/971bb5b715ab13877ca3ec0a79b9b952 to your computer and use it in GitHub Desktop.
select u.*, last_visited
from users u,
lateral(
select concat(date, ' ', time) "last_visited" from site_visits
where user_id = u.id
order by id desc
limit 1
) last_visited
where u.email = 'myuryichev2@guardian.co.uk'
@ofelix03

ofelix03 commented Nov 4, 2022

Copy link
Copy Markdown
Author

update query

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment