I can't seem to properly wrap my brain around left joins. If anyone 
knows of a good tutorial somewhere, I'd appreciate it. That having been 
said, I was hoping someone could help with this query I'm trying to do 
as I've been horribly unsuccessful.

3 tables: goal (own goals), goalopp (opponent goals), game

Pertinent fields:
goal.id
goal.game
goalopp.id
goalopp.game
game.id

One game record for each game.
One goal record for each own goal, one goal record for each opponent 
goal, each with a unique id in their table (goal.id, goalopp.id) and a 
reference to the game id (goal.game, goalopp.game).

What I'm trying to do is get the number of games where the goal count is 
greater than the goalopp count for a set of games. Of course I could 
just loop through an array for each game, but I was hoping to do it with 
a single query. So what I'm getting at is essentially

select (count game) where ((count goal) > (count goalopp)) for each game 
where game.something='whatever'

Help would be greatly appreciated.

Age

---------------------------------------------------------------
  Adriano "Age" Manocchia          [EMAIL PROTECTED]
  Cornell University               AIM/Yahoo/MSN: SalsaSharkNet
  http://salsashark.net/age        ICQ: 5962736
---------------------------------------------------------------
  "The capacity to blunder slightly is the real marvel of DNA.
  Without this special attribute, we would still be anaerobic
  bacteria, and there would be no music." -Lewis Thomas


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