I have a situation where I want to add a record to a table the first time a user performs a certain action. All subsequent actions will update that record. I know I can query the table to see if it exists, but was wondering if there was a way to do that with a single statement.

Code:
insert into t1 (f1, f2) values (1, 2) {if the record doesn't already exist for this user}
I tried a not exists as follows and it didn't like it

Code:
insert into t1 (f1, f2) values (1, 2) where not exists (select * from t1 where userid = 35);