Solved

How to change this to an update script

Posted on 2011-09-28
4
250 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

726 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