update select query [message #411351] |
Fri, 03 July 2009 03:43 |
rajasekhar857
Messages: 500 Registered: December 2008
|
Senior Member |
|
|
hi,
how to write the below query using update select format
UPDATE EMRENCOUNTERDETAILS SET AGE_IN_MONTHS = MONTHS_BETWEEN(PATIENT_DOB, CREATED_DATE ) FROM EMRENCOUNTERDETAILS A
INNER JOIN EMRPATIENTSMASTER B ON A.PATIENT_ID = B.PATIENT_ID
WHERE AGE_IN_MONTHS IS NULL AND IS_SAVE_FOR_LATER = 0
/
|
|
|
|
Re: update select query [message #411358 is a reply to message #411351] |
Fri, 03 July 2009 04:02 |
|
As usual (From all your previous posts) we(I) haven't understood anything, We don't have anything except one UNFORMATTED UPDATE STATEMENT,
After 200+ messages..still you doesn't post the message with formatting...
Are you looking something like this ??
UPDATE (
SELECT *
FROM test
WHERE table_name NOT LIKE '%A%')
SET extent_management = 'Unknown'
WHERE table_name NOT LIKE '%A%';
|
|
|
Re: update select query [message #411359 is a reply to message #411351] |
Fri, 03 July 2009 04:03 |
bonker
Messages: 402 Registered: July 2005
|
Senior Member |
|
|
I did not understand what you mean by update using select format but I assume you mean to use something like this
update (select col1,col2 from tbl1, tbl2 where ..) set col = col2
but bear in mind the table from where you update should be key preserved otherwise you will get ORA-01779 error
|
|
|
Re: update select query [message #411448 is a reply to message #411351] |
Fri, 03 July 2009 15:23 |
|
BlackSwan
Messages: 26766 Registered: January 2009 Location: SoCal
|
Senior Member |
|
|
>how to write the below query using update select format
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
Go to the URL above click the link "Posting Guidelines"
Go to the section labeled "Practice" & do as directed.
Post DDL for tables.
Post DML for test data.
Post expected/desired results.
|
|
|