sort of OT: MySQL question

Página superior
Adjuntos:
Obtener este mensaje como un correo
+ (text/plain)
Eliminar este mensaje
Responder a este mensaje
Autor: Jason Hayes
Fecha:  
A: Main PLUG discussion list
Asunto: sort of OT: MySQL question

Does anyone know the syntax for updating a MySQL database when you are trying
to pull the information from another temporary holding table in the same
database?

My updates are normally accomplished like this,

$query = "UPDATE maindbase SET category1='$cat1', category2='$cat2' WHERE
somevariable=$z";

I know that to pull the data from the temporary database and insert it as a
new field in the main database, I would do this,

$query = "INSERT INTO maindbase (category1, category2) SELECT category1,
category2 FROM tempdbase WHERE somevariable=$x";

I don't want to add a new entry in the database, however. I want to update an
existing entry. How would I go about blending those two queries to mix pulling
information from the temporary database and updating a field in the main
database?

Any thoughts? Thanks!

--
Jason Hayes

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss