Unanswered: Query to update columns from two tables
I want the query to update columns from two tables in Oracle.I have two tables tab1 & tab2.I want to update "tab1_col1" from "tab1" based on "tab1_col2" ,"tab2_col1" AND "tab2_col2" from tab1&tab2 tables.There is some foreign key relation b/w two tables & that column is "col"
That's what I managed to figure out of your question:
UPDATE tab1 t1 SET
t1.col1 = (SELECT some column based on "tab1_col2" ,"tab2_col1" AND "tab2_col2"
from tab1 & tab2 tables
WHERE foreign key relation b/w two tables & that column is "col"
For something more, please, provide CREATE TABLE and INSERT INTO sample data statements so that we could see what you currently have; also, provide example of how you'd want "tab1.col1" look like after UPDATE.
What makes you think that this code *might* work? Did you read the documentation about use of the UPDATE statement? Oracle provides free access to it at http://tahiti.oracle.com so - take a look. Once you learn how to use correct syntax, it will be much easier to write a query.
Just a suggestion: '18-03-08' "look like" a date, but it is not - it is a string. Always, but ALWAYS use the TO_DATE function in order to make a query work correctly (learn how to do that at the same place - Tahiti).