| | |
UPDATE Problem
Please support our Oracle advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Oct 2008
Posts: 23
Reputation:
Solved Threads: 0
Hi,
I have a table which I want to update thus:
If d_date is has a value and b_date is 30 or more then set d_date as the min value already in d_date. I know that the WHERE EXISTS clause is wrong but I don't know how to make this work.
I have a table which I want to update thus:
If d_date is has a value and b_date is 30 or more then set d_date as the min value already in d_date. I know that the WHERE EXISTS clause is wrong but I don't know how to make this work.
Oracle Syntax (Toggle Plain Text)
UPDATE TABLE SET d_date = ( SELECT MIN(d_date) FROM TABLE ) WHERE EXISTS ( SELECT FLOOR( MONTHS_BETWEEN (SYSDATE, b_date) / 12 ) FROM agents WHERE FLOOR( MONTHS_BETWEEN (SYSDATE, b_date) / 12 ) >=30 ) AND d_date IS NOT NULL
•
•
Join Date: Oct 2008
Posts: 23
Reputation:
Solved Threads: 0
Doh! I sorted it out myself:
I was making it more complicated than it was.
Oracle Syntax (Toggle Plain Text)
UPDATE TABLE SET d_date = ( SELECT MIN(d_date) FROM TABLE ) WHERE FLOOR( MONTHS_BETWEEN (SYSDATE, b_date) / 12 ) >=30 AND d_date IS NOT NULL
I was making it more complicated than it was.
Last edited by Roybut; Aug 21st, 2009 at 9:57 am.
![]() |
Similar Threads
- Windows Update problem (Windows Vista and Windows 7)
- need help,,asp.net and sql update problem (ASP.NET)
- update problem???? (ASP.NET)
- System Formatted-Update problem (Windows NT / 2000 / XP)
- Firefox problem - can't install update and Thunderbird -"fights" with Netscape! (Windows NT / 2000 / XP)
- ComboBox UpDate Problem (VB.NET)
- Windows Update Problem (Windows NT / 2000 / XP)
- WMI Update Problem (Windows NT / 2000 / XP)
Other Threads in the Oracle Forum
- Previous Thread: Help wit PLSQL
- Next Thread: Sqldeveloper
| Thread Tools | Search this Thread |
2009predictions acquisition amazon.com bartz bernanke cia citrix cloudcomputing crm database dell economy editor enterprise enterprise2.0 enterprisesoftware federalreserve forbes hp ibm intellipedia internet larryellison layoffs linux loughridge mediawiki michaeljackson microsoft neverland nortel notebooks oil operatingsystem oracle palm rimm saas salesforce sap seagate socialcomputing sql sun sybase technologystocks virtualiron virtualization vmware wiki wikipedia xen yahoo zoho





