By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

Update 3 rows at a time

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
> 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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.