Re: UPDATE with automatic INSERT if not found..

2001-09-13 Thread Joshua M . Schmidlkofer
You COULD do what we do: select GET_LOCK(date) select & (update | insert) select RELEASE_LOCK(date) [I don't recall the exact syntax on the get lock) Anyway, all of our software uses this to emulate row-level locking. It is not as elegant as a 2 line SQL statement,but it is effect

Re: UPDATE with automatic INSERT if not found..

2001-09-13 Thread Alok K. Dhir
Zechel" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, September 13, 2001 8:03 AM Subject: Re: UPDATE with automatic INSERT if not found.. > check the replace syntax: > > http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#REP LACE >

Re: UPDATE with automatic INSERT if not found..

2001-09-13 Thread Henning Schroeder
Hi, >UPDATE stats SET count=count+1 WHERE date=XXX > >BUT, if the date is not there, no counter will be updated so I must first >check this and insert a record if date is not found. Since there is more >than one thread that can write to this table I must use a lock: You COULD do the following (

Re: UPDATE with automatic INSERT if not found..

2001-09-13 Thread Carl Troein
Torgil Zechel writes: > table stats > count int unsigned not null default 0 > datetimestamp (using only year/month part) > > I update this table with: > > UPDATE stats SET count=count+1 WHERE date=XXX > > BUT, if the date is not there, no counter will be upda

Re: UPDATE with automatic INSERT if not found..

2001-09-13 Thread Rene Tegel
check the replace syntax: http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#REPLACE regards rene On Thu, 13 Sep 2001 13:40:44 +0200 "Torgil Zechel" <[EMAIL PROTECTED]> wrote: > Hi! > > I have a counter that is increased each time an event occur. The number of > events

UPDATE with automatic INSERT if not found..

2001-09-13 Thread Torgil Zechel
Hi! I have a counter that is increased each time an event occur. The number of events should be reported as events / month, so along with the counter i have a date-field. The table structure looks like this: table stats count int unsigned not null default 0 date