On Saturday 13 April 2002 4:34 pm, Samwise Gamgee wrote:
> I am trying to update a table with information from that same table and
> another table.   I have two tables, player and goalie, for a hockey pool.
> The field pool_points is total points for forwards, goals * 2 for
> defencemen and point + wins * 2 + ties + shutouts * 5.  The goalie table is
> separate as goalies have a bunch of different stats than skaters.  The
> goalie table's information is matched to the player via the field called
> player_index.  Each player has a player index(unique) and each table
> subsequently has a player_index field.  It is the primary key on player,
> but as of now goalie doesn't have a primary key.  Here is the query that I
> tried:
>
> mysql> update player set pool_points = points +
>     -> (select (shutout*5) +(wins*2) +(ties)
>     -> from goalie, player where goalie.player_index = player.player_index)
>     -> where position = 'g';
>
> ERROR 1064: You have an error in your SQL syntax near 'select (shutout*5)
> +(wins*2) +(ties)
> from goalie, player where goalie.player_ind' at line 2

You cannot do a subselect in MySQL at the moment.  Read the manual on how you 
can get around this.

---------------------------------------------------------------------
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

Reply via email to