hey guys,

this mysql line doesn't seem to work:

SELECT SUM(s.groundballs) AS grounders FROM stats s LEFT JOIN rahs r ON
s.name = r.name WHERE (s.position = '$position')

why not? is there somethign wrong with my syntax? it says this error:
"Supplied argument is not a valid MySQL result resource"

Thanks!
--------------------------------------------
-Alex "Big Al" Behrens
E-mail: [EMAIL PROTECTED]
Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
Phone: 651-482-8779
Cell: 651-329-4187
Fax: 651-482-1391
ICQ: 3969599
Owner of the 3D-Unlimited Network:
http://www.3d-unlimited.com
Send News:
[EMAIL PROTECTED]
----- Original Message -----
From: "Ron Jamison" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 27, 2002 6:21 PM
Subject: RE: SELECT frmo two tables


> If you need to do a join:
>   http://www.mysql.com/doc/J/O/JOIN.html
>
> However I don't see much logic in what you're doing.  Stats should not
> include information that exists in another table, such as name and team.
> You need to decide what information will be unique (such as player
> number) or come up with a new field such as player ID to be used in
> associating tables with one another.
>
> E.g., associating by player number:
>
> Database.players:
> player_name, player_number, team, position
>
> Database.stats:
> player_number, penalty, groundballs, shots, faceoffs_won,
> faceoffs_lost, date
>
> SQL: SELECT SUM(stats.groundballs) AS grounders FROM players LEFT
> JOIN stats ON stats.player_number=players.player_number WHERE
> players.player_name='$name'
>
>
> -----Original Message-----
> From: Alex Behrens [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 27, 2002 4:00 PM
> To: [EMAIL PROTECTED]
> Subject: SELECT frmo two tables
>
>
> Hey All,
>
> I am having problems working on a script and need some advise. Here's my
> problem. I have two tables with teh following variables:
>
> rahs table:
> name, number, team, position
>
> stats table:
> name, team, penalty, groundballs, shots, faceoffs_won, faceoffs_lost,
> date
>
> and I need to make it so using a pulldown menu I can select player stats
> by their position but since the position variable isnt in both tables is
> it possbile to do a select command using a variable from one table for
> another table?
>
> Here's my syntax, but i dont know if it works:
>
> $groundballsquery = mysql_query("SELECT SUM(groundballs) AS grouders
> FROM stats WHERE (position = '$position') FROM rahs");
>
> is it possible to do a WHERE command with a FROM command?
>
> Thanks!
> --------------------------------------------
> -Alex "Big Al" Behrens
> E-mail: [EMAIL PROTECTED]
> Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
> Phone: 651-482-8779
> Cell: 651-329-4187
> Fax: 651-482-1391
> ICQ: 3969599
> Owner of the 3D-Unlimited Network:
> http://www.3d-unlimited.com
> Send News:
> [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> 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

Reply via email to