# two queries at the same time?

#### Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

•  Subject
• Author
• Posted on
Hello!

I have 2 queries:

The are precalculated values.  At the beginning no item can be
matched by both where clauses.

1)
update tabelle
set L = L +
set R = R +
where L >= and R <=

2)
update tabelle
set L = L -
set R = R -
where L >= and R <=

My problem:  If I run update 1 first, the update 2 can match items from
where clause 1 because the update changed the values from L and R so that
they can be found at where clause 2.

And if I run 2 first its the same in the other direction.

So how can I do the 2 where clauses first, and when mysql knows my items I
would like to update so no item gets updatet twice.

Martin

## Re: two queries at the same time?

Martin Klaffenboeck wrote:

UPDATE tabelle
SET L = L
+ IF(L >= AND R <= , , 0)
- IF(L >= AND R <= , , 0)
WHERE L >= AND R <=
OR L >= AND R <=

Regards,
Bill K.

## Re: two queries at the same time?

Martin Klaffenboeck (martin.klaffenboeck@gmx.at) wrote:
: Hello!

: I have 2 queries:

: The are precalculated values.  At the beginning no item can be
: matched by both where clauses.

: 1)
: update tabelle
:    set L = L +
:    set R = R +
: where L >= and R <=

update tabelle
set L = L + ,
R = R + ,
move_number = {the move number}
where L >= and R <=

: 2)
: update tabelle
:    set L = L -
:    set R = R -
: where L >= and R <=

update tabelle
set L = L - ,
R = R - ,
move_number = {the move number}
where L >= and R <=
and move_number < {the move number}

Of course you need to add column "move_number" first.

\$0.10

--

This space not for rent.