RE: Conditional Insert

2006-08-28 Thread Ravi Kumar.
: Johan Höök Cc: Ravi Kumar.; mysql@lists.mysql.com Subject: Re: Conditional Insert Much better. Good job. Douglas Sims [EMAIL PROTECTED] On Aug 29, 2006, at 1:26 AM, Johan Höök wrote: Hi Ravi, you can take a look at: http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html which might

Re: Conditional Insert

2006-08-28 Thread Chris W
Douglas Sims wrote: Hi Ravi You are correct. I was just sitting here thinking about this after I sent that and realized that what I said was incorrect; the "REPLACE" command will not do what you want, because it delete a record instead of updating it, it has no way to know what the previ

Re: Conditional Insert

2006-08-28 Thread Douglas Sims
tching record? Do we have any alternative? Thanks, Ravi. -Original Message- From: Douglas Sims [mailto:[EMAIL PROTECTED] Sent: Tuesday, 29 August, 2006 10:48 AM To: Ravi Kumar. Cc: mysql@lists.mysql.com Subject: Re: Conditional Insert Hi Ravi Standard SQL syntax doesn't provide for

Re: Conditional Insert

2006-08-28 Thread Johan Höök
29 August, 2006 10:48 AM To: Ravi Kumar. Cc: mysql@lists.mysql.com Subject: Re: Conditional Insert Hi Ravi Standard SQL syntax doesn't provide for that. You could wrap the whole thing in a transaction, possibly in a stored procedure, but this would be rather awkward. However, MySQL has a command called

Re: Conditional Insert

2006-08-28 Thread Douglas Sims
, another thread inserts a matching record? Do we have any alternative? Thanks, Ravi. -Original Message- From: Douglas Sims [mailto:[EMAIL PROTECTED] Sent: Tuesday, 29 August, 2006 10:48 AM To: Ravi Kumar. Cc: mysql@lists.mysql.com Subject: Re: Conditional Insert Hi Ravi Standard SQL s

RE: Conditional Insert

2006-08-28 Thread Ravi Kumar.
insert, another thread inserts a matching record? Do we have any alternative? Thanks, Ravi. -Original Message- From: Douglas Sims [mailto:[EMAIL PROTECTED] Sent: Tuesday, 29 August, 2006 10:48 AM To: Ravi Kumar. Cc: mysql@lists.mysql.com Subject: Re: Conditional Insert Hi Ravi Standard

Re: Conditional Insert

2006-08-28 Thread Douglas Sims
Hi Ravi Standard SQL syntax doesn't provide for that. You could wrap the whole thing in a transaction, possibly in a stored procedure, but this would be rather awkward. However, MySQL has a command called "REPLACE" which I think will do exactly what you want: http://dev.mysql.com/doc/r

Conditional Insert

2006-08-28 Thread Ravi Kumar.
Dear Members, I wish to insert and update conditionally into a table using a single SQL statement. That is if a record already exists in a table, the statement should update it, else it should insert it. Probably something like this: if (select * from UserPoints where username = 'ravi') then (

Re: Conditional insert or update.

2005-07-20 Thread Paul Halliday
Ok, The entire table looks like this: ip | hostname | mac_current | mac_change | port_current | port_change The IP addresses are harvested via netflow (a different table) and or arpwatch (an event). This new table is to augment the current information that is within the netflow tables but speci

Re: Conditional insert or update.

2005-07-20 Thread Gleb Paharenko
Hello. Please, provide more information on your's application logic. To catch events which occurs for the table use triggers. See: http://dev.mysql.com/doc/mysql/en/triggers.html Unfortunately they're available only in MySQL 5.0.x, which is still beta. Paul Halliday <[EMAIL PROTEC

Conditional insert or update.

2005-07-20 Thread Paul Halliday
Hi, I have a table that looks something like this: ip | mac_current | mac_change now if I have an entry that looks like this 10.0.0.1 | 11:11:11:11:11:11:11 | NULL If the next time the script runs and the mac has changed, how can I catch this and put the new MAC into mac_change? Ultimately,

Complex conditional insert

2003-11-04 Thread Matt Young
I have two table, accounts describing various accounts and gives the account balance and ledger, which recodrs all account transactions. Playing around with the accounting tables, I have an user transaction that goes into the ledger but the values placed in the ledger balance columns depend on