473,405 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Update 3 rows at a time

Hi friends,

Can anyone guide me on this.

Just assume i have table name "Alphabet" and a field name "Name".

Inside the table contains:

Name
A(1st row)
B(2nd row)
C(3rd row)

and i wana update
A -> D
B -> E
C -> F

How is it possible to do using one single SQL?

I really appreciate your reply.

Thanks guys.

May 19 '06 #1
3 1354
> Just assume i have table name "Alphabet" and a field name "Name".

Name
A(1st row)
B(2nd row)
C(3rd row)
and i wana update
A -> D
B -> E
C -> F
How is it possible to do using one single SQL?


UPDATE AlphaBet SET AlphaBet.Name = Chr(Asc([Name])+3)
WHERE (((AlphaBet.Name)="A")) OR (((AlphaBet.Name)="B")) OR (((AlphaBet.Name)="C"));

--
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype: pbsoftsolution
May 19 '06 #2
Yes, its working fine with your coding, Thanks.

But how if it is not an alphabet or a word such as

Mouse -> Snake
Snake -> Eagle
Deer -> Tiger

Earlier i juzt use Alphabatical so that easy for the reader to
understand. Can you guide me on above situation if it is a word rather
than alphabet. Thanks again.

May 19 '06 #3
SQL is all about sets.

In this situation where there is nothing to group the original values
together and nothing to describe the update you would have to use separate
updates for each line.

In your original example a rule could be created for the update, this is not
the case with this example.

The only way to get round this would be to create a "translation" table, in
this table you would define the original value and the target value you
could then use this to update your table. This really is only any use where
the values appear multiple times and would certainly not be suitable in a
case as trivial as the one you cite.
--

Terry Kreft
"equalive" <eq******@yahoo.com> wrote in message
news:11*********************@j73g2000cwa.googlegro ups.com...
Yes, its working fine with your coding, Thanks.

But how if it is not an alphabet or a word such as

Mouse -> Snake
Snake -> Eagle
Deer -> Tiger

Earlier i juzt use Alphabatical so that easy for the reader to
understand. Can you guide me on above situation if it is a word rather
than alphabet. Thanks again.

May 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
8
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON...
3
by: Josué Maldonado | last post by:
Hello list, I have 7.3.4 on RH 8, server hardware is a dual processor Intel Xeon 2.4 Ghz, 2G RAM, 27Gb HD available on postgres partition. Table cost2est2003 with 99350 recs is described as:...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
15
by: graham | last post by:
Hi all, <bitching and moaning section> I am asking for any help I can get here... I am at the end of my tether... I don;t consider myself a genius in any way whatsoever, but I do believe I have...
29
by: Geoff Jones | last post by:
Hi All I hope you'll forgive me for posting this here (I've also posted to ado site but with no response so far) as I'm urgently after a solution. Can anybody help me? I'm updating a table on...
4
by: Nick Barr | last post by:
Hi, I am trying to gather stats about how many times a resource in our web app is viewed, i.e. just a COUNT. There are potentially millions of resources within the system. I thought of two...
1
by: bughunter | last post by:
simple query select * from "Result" res where (res."QID" = 51541 or res."QID" = 51542) works fine ("SRV-BL"."Result" ~ 900000 rows) and returns 36 rows but update - no! update...
2
by: Miro | last post by:
I will ask the question first then fumble thru trying to explain myself so i dont waste too much of your time. Question / Statement - Every mdb table needs a PrimaryKey ( or maybe an index - i...
3
by: Michel Esber | last post by:
Hi all, DB2 V8 LUW FP 15 There is a table T (ID varchar (24), ABC timestamp). ID is PK. Our application needs to frequently update T with a new value for ABC. update T set ABC=? where ID...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.