Re: lug-bg: MySQL update
- Subject: Re: lug-bg: MySQL update
- From: "Peter Zyumbilev" <bivol@xxxxxx>
- Date: Fri, 19 Sep 2003 17:10:49 +0300
Variant 1
update tablenmae set credit = credit + 5 where (user_id >0 and user_id <5)
or (user_id >6 and user_id <8);
Variant 2
update tablenmae set credit = credit + 5 where user_id in(1,2,3,4 , 7,8)
Po princip ako beshe *normalna* baza danii ili mysql 4.1 i ako ti tribvah
po slojjni nesta se praviat sas subselect no v tvoia sluchai ne e nujno.
BIVOL
--
----- Original Message -----
From: "martin petkov" <martin_petkov@xxxxxxxxx>
To: <lug-bg@xxxxxxxxxxxxxxxxxx>
Sent: Friday, September 19, 2003 3:28 PM
Subject: lug-bg: MySQL update
> Zdraveite,
> bihte li me posyvetvali za slednata situacia
>
> iskam da update-na opredeleni stoinosti v dadena
> kolona po uslovie ot druga kolona v syshtata tablica
> naprimer
> ----------------
> |user_id|credit|
> ----------------
> |1 |10 |
> |2 |10 |
> |3 |10 |
> |4 |10 |
> |5 |20 |
> |6 |20 |
> |7 |10 |
> |8 |10 |
> ----------------
>
> t.e. kak da se update-nat stoinostite na credit (s 5
> naprimer), koito sa s user_id ot 1-4 i 7-8 .
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
============================================================================
> A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
> http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara
Zagora
> To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
>
============================================================================
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================
|