Qry help...

2006-12-03 Thread Ken Ferguson
I'm having a small query brain-fart that I can't seem to overcome. It's not that difficult, but I keep screwin' it up. Given three tables with relationships such as these: *Incidents incID *People personName incID *ToolsUsed toolID incID The tools used will either have some id in it or

Re: Qry help...

2006-12-03 Thread Jim Wright
Ken Ferguson wrote: So, I'd like to see: John - 40% - 5 incidents Sue - 50% - 4 incidents Try something like this... SELECT p.personName,(SUM(CASE t.tool WHEN '-5' THEN 100 ELSE 0 END)/count(t.tool)) as notoolpercent FROM People p INNER JOIN ToolsUsed t ON p.IncID = t.IncID GROUP BY

RE: Qry help...

2006-12-03 Thread Ken Ferguson
That's the one. Outstanding - thank you very much sir. Thanks, Ferg -Original Message- From: Jim Wright [mailto:[EMAIL PROTECTED] Sent: Sunday, December 03, 2006 1:09 PM To: CF-Talk Subject: Re: Qry help... Ken Ferguson wrote: So, I'd like to see: John - 40% - 5 incidents Sue