| update select query [message #411351] |
Fri, 03 July 2009 03:43  |
rajasekhar857 Messages: 415 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 #411357 is a reply to message #411351] |
Fri, 03 July 2009 03:55   |
Michel Cadot Messages: 28979 Registered: March 2007 Location: Nanterre, France, http://... |
Senior Member |
|
|
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).
Regards
Michel
|
|
|
| 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: 389 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: 3227 Registered: January 2009 |
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.
|
|
|