Difficult SQL (for me) - please help!
| From: | Brian Dunning | Date: | Sun, 06 Jun 2004 04:26:51 +0000 |
| Subject: | Difficult SQL (for me) - please help! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-187721@lists.php.net to get a copy of this message | ||
Thanks to all who helped with my earlier SQL question. It was exactly what I needed. But now I'm making it more involved. Tom and Dick are competing salesmen. The data looks like this:
Tom Pitch
Dick Pitch
Tom Sale
Dick Sale
Tom Pitch
I want to show a list of salesmen, sorted by rate of sales:
Dick 1 sale in 2 tries, 50.0%
Tom 1 sale in 3 tries, 33.3%Is this possible with a single SQL statement? Many thanks, - Brian