ViperSBT Posted December 1, 2009 Share Posted December 1, 2009 I have the following query: SELECT r.club, MIN(r.besttime) as time, c.cname, t.date FROM racing r JOIN clubs c ON r.club = c.cnumber INNER JOIN tournament t ON t.enumber = r.event && t.date >= '$limit' && r.besttime < 99.999 GROUP BY r.club HAVING DATEDIFF( MAX( date ) , MIN( t.date ) ) >4 ORDER BY time, c.cname Which generates the following output: club time cname date 83 0.000 BH 2005-07-08 146 0.000 MRRFB 2006-03-25 179 0.000 PS 2006-09-23 22 0.000 S 2005-04-30 2 14.963 TNG 2005-04-30 239 15.127 IR 2007-05-26 75 15.359 HF 2005-11-12 7 15.403 RD 2005-05-14 6 15.479 RDS 2005-05-14 The racing table has an entry for every event that a club has participated in. I need the results to only show me clubs that have participated in more than one event and at least two of those events are more than 7 days apart from each other. It seems like there should be a way to do this, but I am lucky I have gotten as far as I have... Quote Link to comment Share on other sites More sharing options...
ViperSBT Posted December 3, 2009 Author Share Posted December 3, 2009 I have been trying to come up with some way of doing this... I am thinking that 'HAVING' might be applicable here, but can't seem to make it work... Quote Link to comment Share on other sites More sharing options...
ViperSBT Posted December 10, 2009 Author Share Posted December 10, 2009 Anyone? Am I trying to do something that is simply impossible? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.