Skip to content

Instantly share code, notes, and snippets.

@sha1sum
Created October 7, 2015 18:01
Show Gist options
  • Save sha1sum/a22f3d21011b5d6f9478 to your computer and use it in GitHub Desktop.
Save sha1sum/a22f3d21011b5d6f9478 to your computer and use it in GitHub Desktop.
update logs
set app_id = case when apps.id is not null then apps.id else 0 end
from logs l
left outer join apps
on l.app_name = apps.name
AND l.company_id = apps.company_id
where
logs.id = l.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment