Page 1 of 1

Need some urgent help in using UPDATE command in SQL

Posted: Sat Oct 20, 2007 12:17 am
by legend986
I have two tables:

Table Name: table1
Table Rows: a b

Table Name: table2
Table Rows: a b c d e f

Initially c of table2 is empty. I want to actually fill it up from table1 using some statement like:

Code: Select all

UPDATE table2 SET c={SELECT a FROM table1 WHERE b=d}

Where d belongs to table2.

Is this possible?

Posted: Sat Oct 20, 2007 1:29 am
by Charles256
Change the { into ( and } into ). Next question, have you tried it? I suspect if you had you wouldn't be asking the question ;) ( hint. it's called subqueries if you're using google to find more information about it ).

Posted: Sat Oct 20, 2007 1:30 am
by legend986
I was actually typing that I figured out the solution when I got your reply :) Thanks for the information... Realized my mistake...