Updating a sinle column of a single row...
Hi all. First post.
I have a simple database with columns like 'memberNumber', 'phone', 'fax', 'email' and so on.
'memberNumber' is the primary key.
Sometimes I need to update a specific column of a specific row, because new info is sent from an update server.
The update server ONLY sends the essential data...the memberNumber and the item(s) needing to be updated (phone for example).
If the memberNumber is new (ie. not already in the table) then a new row needs to be created, populated with whatever additional data is also sent.
So I need a SQL command to replace the value a specific column(s) of a single row within the table, and create a new row if necessary.
I thought I could use REPLACE and only include the primary key and the data needing to be changed, but doing so resets all the other columns in that row to NULL.
UPDATE is not quite right either because it can't create a new row.
Can I do this with just 1 simple command, or do I need to read the existing table data, determine if the row exists, then decide whether to use INSERT or UPDATE?
Thanks for your input.