Solved

How to change this to an update script

Posted on 2011-09-28
4
248 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
ID: 36718137
Should have stated the table to update is PRODUCT and the field to update is Removed
0
 
LVL 76

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 73

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 73

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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle 12c database link between pdb not working 20 76
How to free up undo space? 3 41
run sql script from putty 4 35
error in my cursor 5 30
Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to recover a database from a user managed backup

772 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