473,583 Members | 3,563 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Recursive update query

43 New Member
hi
i have a table like

col1 col2 col3 col4
35 R 0 0
36 W 1 35
37 R 0 0
38 W 2 35,36

I am giving col1 value 35 as input
i want to write a update query so that the result
col1 col2 col3 col4
35 C 0 0
36 R 0 0
37 R 0 0
38 W 1 36

pls give me any clues to write this recursive update query
Jul 16 '08 #1
3 2205
amitpatel66
2,367 Recognized Expert Top Contributor
You will need to write a stored proceudure for that!!
Jul 16 '08 #2
srinit
43 New Member
You will need to write a stored proceudure for that!!
Can you please tell me how can i write that procedure.
Jul 17 '08 #3
Delerna
1,134 Recognized Expert Top Contributor
in column 2 what do C,R,W mean?
What are the rules to follow for the update?
There are lots of other questions that will come up

Really, you are in the best position to see how the stored proc should be written
because
You have access to the data.
You know what you want to achieve.
You know the environment you are working in.
You know the design of the database
You can write test queries,UDF's etc etc on your data and run them to see what happens

Think about the above questions and try and come up with ideas to achieve it.
Perhaps you could use a cursor? (Recommended as a last resort)
You can write recursive queries! (This could be the path you should follow)
Maybe some other method there are hundreds?
The help documents can help you there
If you get stuck we are only too happy to help you over the bit you are stuck on.


PS I am trying to be helpfull here
Jul 17 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3119
by: replace-this-with-my-name | last post by:
Hi. How do I return a string containing an entire menu-tree from a recursive function? Here is my current recursive function: function page_tree( $_i ){ //Call global mysql connection variable
2
7019
by: Perttu Pulkkinen | last post by:
I need to find toplevel image categories and a) number of images directly in them and b) number of subcategories directly in those topcategories. In toplevel image categories "icat_parent_id IS NULL". Below is also current erraneous draft but it has ambigous filed name problem. CREATE TABLE icategories ( icat_id int(11) NOT NULL...
6
6315
by: Tim Pascoe | last post by:
I have a database which stores information about organisms collected during sediment toxicology research. For each sample, organisms in sediment are collected and identified taxonomically (Order, Family, Genus, Species). Taxonomy lookup information in the database is stored in a recursive table in the form: TSN (taxa serial number) Rank...
14
9281
by: Bob | last post by:
Hi there, Need a little help with a certain query that's causing a lot of acid in my stomach... Have a table that stores sales measures for a given client. The sales measures are stored per year and there could be multiple sales measures every year per client. There is another field called last update date. If there are multiple sales...
3
4153
by: Vincenzino | last post by:
Hi, I have some problem in using SQL3 recursive queries on DB2 database system (8.1 and 8.2 UDB). I need to compute the transitive closure of a (possibly) ciclic graph using SQL3 on DB2. I MUST use pure SQL3 and I cannot use cursors, indexes and the like. The graph is represented by a set of arcs with the table "arc" having two attributes...
1
1985
by: martinghale | last post by:
Hello, I have to create an AFTER UPDATE trigger that needs to perform an UPDATE on the same table. I understand this is a recursive situation and I'm wondering if there is a way to NOT go through all 16 levels of recursion. Ideally the UPDATE performed by the trigger would not cause the trigger to fire again, although that is what I'm...
10
2545
by: AsheeG87 | last post by:
Hello Everyone! I have a linked list and am trying to include a recursive search. However, I am having trouble understanding how I would go about that. I don't quite understand a recursive search....would any of you be so kind to explain it to me...maybe include some examples. I would GREATLY appreciate it!!!
2
5515
by: Jim Devenish | last post by:
I have a table named StockItems with field: StockItemID QuantityInStock I am creating assemblies of stock items and have another table named StockItemAssemblies with fields: StockItemAssemblyID AssemblyID StockItemID Quantity
2
4892
by: omkarkapashikar | last post by:
Hi, I have a table with id and name as column like below. Id Name 0 a 0 b 0 C table can have n rows. All n rows contain 0 as id. Now I want to update table such as id column increment like 1,2,3 ,4 for every row. ...
0
7894
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7821
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8320
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8190
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5697
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3814
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3841
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1152
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.