Solved

How to change this to an update script

Posted on 2011-09-28
4
251 Views
Last Modified: 2012-05-12
I need to change what was posted in this link to an update statement where SET Records = 'T'

http://www.experts-exchange.com/Database/Oracle/Q_27343597.html
0
Comment
Question by:gilnari
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:gilnari
ID: 36718137
Should have stated the table to update is PRODUCT and the field to update is Removed
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36718160
That question selects from a table called analysis.

What are the tables linked?  in other words, what columns in analysis cause removed to be updated to a 'T' in product?
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 36718195
i'll take a guess based on previous questions but I too am confused as to the connection.
particularly since the link above points to removed='F'  but here you're setting it to 'T'


UPDATE product
   SET removed = 'T'
 WHERE analysis IN
           (SELECT name
              FROM (SELECT a.*,
                           ROW_NUMBER() OVER (PARTITION BY name ORDER BY version DESC) rn,
                           COUNT(*) OVER (PARTITION BY name) cnt
                      FROM analysis a)
             WHERE cnt > 1 AND NOT (rn = 1 AND removed = 'F'))
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 36718204
if that's not correct,  please supply the column(s) needed to connect product to analysis.
and, if there are any other conditions that apply
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question