Skip to content

Instantly share code, notes, and snippets.

@a1994sc
Created September 20, 2016 22:51
Show Gist options
  • Save a1994sc/798d88f4e69fe1403d4ef04aa0b8cb8f to your computer and use it in GitHub Desktop.
Save a1994sc/798d88f4e69fe1403d4ef04aa0b8cb8f to your computer and use it in GitHub Desktop.
A insert or replace to add a number to sql entry.
insert or replace into office
values
(124567,
(select
case
when (select exists(select 1 from office where sku = 124567))
then (select count from office where sku = 124567)
when 1 then 0
end
) + 1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment