Aici veti gasi detalii tehnice despre cum se pot realiza configurari software+ hardware.
Here you can find tehnical details about software/hardware configuration.

miercuri, 7 septembrie 2011

Mysql update from another table

1. Open up phpmyadmin or similar database editor
2. view the sql query below

Code (sql)

UPDATE updatefrom p, updateto pp
SET pp.last_name = p.last_name
WHERE pp.visid = p.id

Lets say we have 2 tables one named main and one named updateto and one named updatefrom, In the first line we assign variables to these t tables (p and pp) from there we can call column names using this format table.columname. If we had first_name and last_name in both tables and wanted to update the “updateto” table with the info from “updatefrom” this is how you would write it.

If you need to update multiple rows in same query :


Code (sql)

UPDATE updatefrom p, updateto pp
SET pp.last_name = p.last_name,
pp.first_name = p.first_name
WHERE pp.visid = p.id

Niciun comentariu:

Map


Visitor Map