MrsMonteCristo
03-21-2007, 03:41 PM
Hi and thanks for looking !!
I am a little stuck with a query I am trying to create and was hoping that someone could help me out !
I dont know if this is the right way but hopefully one of you guys will be able to advise.
I have a database with approx 700 golf club member in who all have a unique ID number (primary key) the records go back over 6 years and are grouped by competition date. the players score for each hole is entered into seperate columns within the table and here is what I am trying to achieve.
I need to create a query that displays the players lowest score on each hole throughout the season. So i want my query to return a single line for each ID and grab the lowest score from all dates for each hole.
I have a query
SELECT DISTINCTROW CHRECORDB.MEM, Min(CHRECORDB.GR1) AS [Min Of GR1], Min(CHRECORDB.GR2) AS [Min Of GR2], Min(CHRECORDB.GR3) AS [Min Of GR3], Min(CHRECORDB.GR4) AS [Min Of GR4], Min(CHRECORDB.GR5) AS [Min Of GR5], Min(CHRECORDB.GR6) AS [Min Of GR6], Min(CHRECORDB.GR7) AS [Min Of GR7], Min(CHRECORDB.GR8) AS [Min Of GR8], Min(CHRECORDB.GR9) AS [Min Of GR9], Min(CHRECORDB.GR10) AS [Min Of GR10], Min(CHRECORDB.GR11) AS [Min Of GR11], Min(CHRECORDB.GR12) AS [Min Of GR12], Min(CHRECORDB.GR13) AS [Min Of GR13], Min(CHRECORDB.GR14) AS [Min Of GR14], Min(CHRECORDB.GR15) AS [Min Of GR15], Min(CHRECORDB.GR16) AS [Min Of GR16], Min(CHRECORDB.GR17) AS [Min Of GR17], Min(CHRECORDB.GR18) AS [Min Of GR18]
FROM CHRECORDB
GROUP BY CHRECORDB.MEM;
The only problem is that at some stage of the season most players return a no score and a zero gets entered and the table from the above query returns
How do I get each row to return the min value as long as it is greater than zero ?
Thanks in advance
I am a little stuck with a query I am trying to create and was hoping that someone could help me out !
I dont know if this is the right way but hopefully one of you guys will be able to advise.
I have a database with approx 700 golf club member in who all have a unique ID number (primary key) the records go back over 6 years and are grouped by competition date. the players score for each hole is entered into seperate columns within the table and here is what I am trying to achieve.
I need to create a query that displays the players lowest score on each hole throughout the season. So i want my query to return a single line for each ID and grab the lowest score from all dates for each hole.
I have a query
SELECT DISTINCTROW CHRECORDB.MEM, Min(CHRECORDB.GR1) AS [Min Of GR1], Min(CHRECORDB.GR2) AS [Min Of GR2], Min(CHRECORDB.GR3) AS [Min Of GR3], Min(CHRECORDB.GR4) AS [Min Of GR4], Min(CHRECORDB.GR5) AS [Min Of GR5], Min(CHRECORDB.GR6) AS [Min Of GR6], Min(CHRECORDB.GR7) AS [Min Of GR7], Min(CHRECORDB.GR8) AS [Min Of GR8], Min(CHRECORDB.GR9) AS [Min Of GR9], Min(CHRECORDB.GR10) AS [Min Of GR10], Min(CHRECORDB.GR11) AS [Min Of GR11], Min(CHRECORDB.GR12) AS [Min Of GR12], Min(CHRECORDB.GR13) AS [Min Of GR13], Min(CHRECORDB.GR14) AS [Min Of GR14], Min(CHRECORDB.GR15) AS [Min Of GR15], Min(CHRECORDB.GR16) AS [Min Of GR16], Min(CHRECORDB.GR17) AS [Min Of GR17], Min(CHRECORDB.GR18) AS [Min Of GR18]
FROM CHRECORDB
GROUP BY CHRECORDB.MEM;
The only problem is that at some stage of the season most players return a no score and a zero gets entered and the table from the above query returns
How do I get each row to return the min value as long as it is greater than zero ?
Thanks in advance