Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- merge brief_log as Target
- using (select id from brief_log
- where login = 'john'
- and day(first_check_date) = day(getdate())
- and month(first_check_date) = month(getdate())
- and year(first_check_date) = year(getdate())) as Source
- on Target.id = Source.id
- when matched then
- update set
- count += 1
- when not matched by target then
- insert values
- ('john', getdate(), null, null, 1, null);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement