This content has been marked as final. Show 1 reply
848391 wrote:So table2 only has one column?
I have the following query:
field1=(select * from table2 ...
You can get both columns from table2 at the same time, using MERGE:
MERGE INTO table1 dst USING ( SELECT MIN (CASE WHEN column1 = 'y' THEN column1 END) AS field1 , MIN (CASE WHEN column1 = 'n' THEN column1 END) AS field2 FROM table2 WHERE column1 IN ('y', 'n') ) src ON (dst.col = '12qw') WHEN MATCHED THEN UPDATE SET dst.field1 = src.field1 , dst.field2 = src.field2 ;
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Since you're asking about a DML statement, the sample data will be the contents of the tables before the DML, and the results will be state of the changed table when everything is finished.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using.