Solved

How to change this to an update script

Posted on 2011-09-28
4
246 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
  • 2
4 Comments
 

Author Comment

by:gilnari
Comment Utility
Should have stated the table to update is PRODUCT and the field to update is Removed
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
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 73

Accepted Solution

by:
sdstuber earned 500 total points
Comment Utility
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 73

Expert Comment

by:sdstuber
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now