It's hard to tell what you're after exactly. But the
following may be helpful:
select
p.full_name,
sum ( case
when actual_winner = pick_winner then 1
else 0
end ) as total_wins,
sum ( case
when actual_winner <> pick_winner then 1
else 0
end ) as total_losses
from tbl_weekly_picks wp join tbl_participants p on
p.part_Id = wp.part_id
group by p.full_name
I'll be curious to know if this is helpful.
et
[quoted text, click to view] >-----Original Message-----
>I have two tables
>tbl_participants
> part_id PK
> full_name
>
>tbl_weekly_picks
>
> part_id FK
> pick_winner
> actual_winner
> total_pts
>
>I want to do a sql query to find the total wins, losses
and pts. The
>pts are easy as they are a computed field (sum
(total_pts)). If the
>actual_winner = pick_winner then it is a win else it is a
loss. Please
>help
>
>
>
>
>*** Sent via Developersdex
http://www.developersdex.com ***
>Don't just participate in USENET...get rewarded for it!
>.