Re: SQL - Update problem

2002-08-28 Thread Gelu Gogancea

Hi,

Egor has right and i didn't read very carefully you e-mail.Sorry

You can try this :
SET @a:=0;
SET @b:=0;
SELECT @a:=COUNT(*),@b:=sekce.id FROM odkaz,sekce WHERE odkaz.sekce_id =
sekce.id;
UPDATE sekce SET pocet = @a  WHERE  id= @b;

Now...i think it's corect...

Regards,

Gelu
_
G.NET SOFTWARE COMPANY

Permanent e-mail address : [EMAIL PROTECTED]
  [EMAIL PROTECTED]
- Original Message -
From: "Jakub Mach" <[EMAIL PROTECTED]>
To: "Mysql" <[EMAIL PROTECTED]>
Sent: Wednesday, August 28, 2002 5:15 PM
Subject: SQL - Update problem


> Hi,
>
> how can I do sql command like this:
>
> update sekce set pocet = count(*) from odkaz where odkaz.sekce_id =
sekce.id
>
> Thanks for answer
>
> j.
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: SQL - Update problem

2002-08-28 Thread Gelu Gogancea

Hi,

...adding a new query and using variable:

SET @a:=0; --initialize variable a;
select @:=COUNT(*) from odkaz where odkaz.sekce_id = sekce.id;
update sekce set pocet = @a where odkaz.sekce_id = sekce.id;


Regards,

Gelu
_
G.NET SOFTWARE COMPANY

Permanent e-mail address : [EMAIL PROTECTED]
  [EMAIL PROTECTED]
- Original Message -
From: "Jakub Mach" <[EMAIL PROTECTED]>
To: "Mysql" <[EMAIL PROTECTED]>
Sent: Wednesday, August 28, 2002 5:15 PM
Subject: SQL - Update problem


> Hi,
>
> how can I do sql command like this:
>
> update sekce set pocet = count(*) from odkaz where odkaz.sekce_id =
sekce.id
>
> Thanks for answer
>
> j.
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: SQL - Update problem

2002-08-28 Thread Egor Egorov

Jakub,
Wednesday, August 28, 2002, 5:15:01 PM, you wrote:

JM> how can I do sql command like this:

JM> update sekce set pocet = count(*) from odkaz where odkaz.sekce_id = sekce.id

First: multi-table updates is supported only since 4.0.2
Second: even on 4.0.2 you can't do it with above query



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   <___/   www.mysql.com



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




[select into] RE: SQL - Update problem

2002-08-28 Thread Wouter van Vliet

Hmm .. isn't there any workaround for this .. Maybe something like:

select count(*) into :somerVar FROM table;
update sekce set pocet = :someVar WHERE ... blabla;

I've seen things like this in other databas servers but haven't been able to
find out if it's supported by MySQL, and if so, how...

Thanks,
Wouter

-Oorspronkelijk bericht-
Van: Mary Stickney [mailto:[EMAIL PROTECTED]]
Verzonden: August 28, 2002 16:37
Aan: Jakub Mach; Mysql
Onderwerp: RE: SQL - Update problem



you cant update from is NOT supported


-Original Message-
From: Jakub Mach [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 28, 2002 9:15 AM
To: Mysql
Subject: SQL - Update problem


Hi,

how can I do sql command like this:

update sekce set pocet = count(*) from odkaz where odkaz.sekce_id = sekce.id

Thanks for answer

j.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: SQL - Update problem

2002-08-28 Thread Mary Stickney


you cant update from is NOT supported


-Original Message-
From: Jakub Mach [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 28, 2002 9:15 AM
To: Mysql
Subject: SQL - Update problem


Hi,

how can I do sql command like this:

update sekce set pocet = count(*) from odkaz where odkaz.sekce_id = sekce.id

Thanks for answer

j.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




SQL - Update problem

2002-08-28 Thread Jakub Mach

Hi,

how can I do sql command like this:

update sekce set pocet = count(*) from odkaz where odkaz.sekce_id = sekce.id

Thanks for answer

j.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php