Results 1 to 6 of 6
  1. #1
    mpreston14 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2013
    Posts
    41

    Displaying data if potentially null

    I have a Soccer/Football Referee database that works very well so far, but I am having a bit of trouble with the final report (via a query) that will pull all of the data together in one place.

    Thanks to everyone here I was able to get the query to work in general, but I have a problem with Null values.

    Here is the output:
    RefID LastName FirstName Matches Age Grade Total Points FitTestBonus Highest Ref League Highest Ref Match Highest Ref Final Highest AR League Highest AR Match Highest AR Final
    445 XXX YYYYY 18 17 8 2412.087 1.128 RIWSL WOMENS OPEN - F No RISL O30/O40 - M No
    86 CCCC DDDDD 19 21 8 2108.75 1 Super Liga BU12 No SNESC MENS OPEN - M No
    374 EEEE FFFFF 19 19 8 1545.3 1 Super Liga BU12 No Super Liga BU12 No
    611 GGGGGG HHHHHH 14 17 8 1279.0305 1.089 Super Liga GU10 No Maple BU13 No


    In the above examples everything displays correctly, however if a Referee has not been a Center Ref (displayed as Ref above) or has not been an Assistant Ref (displayed as AR above) they do not appear on the query output.

    So how can I define the query to include Ref SSSSS TTTTT who hasnt been a Center Ref and only an Assistant Ref in the output:

    RefID LastName FirstName Matches Age Grade Total Points FitTestBonus Highest Ref League Highest Ref Match Highest Ref Final Highest AR League Highest AR Match Highest AR Final
    445 XXXX YYYYY 18 17 8 2412.087 1.128 RIWSL WOMENS OPEN - F No RISL O30/O40 - M No
    86 AAAAA BBBBB 19 21 8 2108.75 1 Super Liga BU12 No SNESC MENS OPEN - M No
    374 CCCCC DDDD 19 19 8 1545.3 1 Super Liga BU12 No Super Liga BU12 No
    611 EEEEE FFFFF 14 17 8 1279.0305 1.089 Super Liga GU10 No Maple BU13 No
    393 SSSSS TTTTTT 4 22 8 400.33 1.109 Null Null Null Super Liga GU14 No


    SQL is below. I haven't aliased the tables or queries yet, hopefully not so horrible to read.

    SELECT Referee_T.RefID, Referee_T.LastName, Referee_T.FirstName, Referee_T.Town, Referee_T.Gender, Count(Officiated_Matches_T.AssignmentID) AS Total_Matches, Int((Now()-[DOB])/365.25) AS Age, Referee_T.Grade, Sum([Officiated_Matches_T].Points*Referee_T.FitTestBonus) AS [Total Points], Referee_T.FitTestBonus, [Highest Ref Detail].League AS [Highest Ref LEague], [Highest Ref Detail].Match AS [Highest Ref Match], [Highest Ref Detail].[Final/Semi-Final] AS [Highest Ref Final], [Highest AR Detail].League AS [Highest AR League], [Highest AR Detail].Match AS [Highest AR Match], [Highest AR Detail].[Final/Semi-Final] AS [Highest AR Final]
    FROM ((Referee_T INNER JOIN Officiated_Matches_T ON Referee_T.RefID = Officiated_Matches_T.RefID) INNER JOIN [Highest Ref Detail] ON Referee_T.RefID = [Highest Ref Detail].RefID) INNER JOIN [Highest AR Detail] ON Referee_T.RefID = [Highest AR Detail].RefID
    GROUP BY Referee_T.RefID, Referee_T.LastName, Referee_T.FirstName, Referee_T.Town, Referee_T.Gender, Int((Now()-[DOB])/365.25), Referee_T.Grade, Referee_T.FitTestBonus, [Highest Ref Detail].FirstOfAssignmentID, [Highest Ref Detail].League, [Highest Ref Detail].Match, [Highest Ref Detail].[Final/Semi-Final], [Highest AR Detail].FirstOfAssignmentID, [Highest AR Detail].League, [Highest AR Detail].Match, [Highest AR Detail].[Final/Semi-Final]
    HAVING (((Int((Now()-[DOB])/365.25))<25) AND ((Referee_T.Grade)=8))


    ORDER BY Sum([Officiated_Matches_T].Points*Referee_T.FitTestBonus) DESC;


    Many thanks for your help!

    Mike
    Last edited by mpreston14; 10-06-2013 at 06:33 PM. Reason: fixed formatting of the table

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    Maybe:
    Do a query for the Center refs. Do a query for Assistant Refs. Join both to a master dataset of all refs, join type "Show all records from {master dataset} ..."
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mpreston14 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2013
    Posts
    41
    Thanks June7, I will try that.

    Anyone else think this is possible?

  4. #4
    mpreston14 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2013
    Posts
    41
    Actually that gives me the same problem, if the ref didn't do a Center Ref they don't appear on list.

    The list started out as a ranking list, giving us the top ranked referees. When we post the ranking data, we wanted to also list their highest Center Ref and AR matches.

    So when I run the list, it still needs to rank the referees by their points, but then display the data associated with each referee.

    Thanks!!

  5. #5
    mpreston14 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2013
    Posts
    41
    Something I think that might make it easier to understand is that the "Position" Table (and field) has 3 possible entries, Referee, AR, and 4th (for 4th Official). Every Assignment ID is linked to a Referee and his or her position. So the field Position is never actually Null, it is always one of the 3 entries and therefore not really "Null".

    With that noted, if a Referee doesn't have an entry in the table as any of those positions, how do I still list them in the Ranking Query?

  6. #6
    mpreston14 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2013
    Posts
    41
    It was the JOINS! I switched the joins from Inner to Left between the temp tables I used to pull out the specific match data and it worked like a charm!

    Thanks again for all of your help!

    Mike

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Only displaying non-null fields in query??
    By skier4life in forum Queries
    Replies: 1
    Last Post: 06-24-2013, 08:53 AM
  2. Displaying Count if Null value exists
    By adams.bria in forum Queries
    Replies: 3
    Last Post: 08-31-2011, 11:56 AM
  3. Displaying data from 2 tables in one
    By kbremner in forum Forms
    Replies: 6
    Last Post: 10-28-2010, 10:02 AM
  4. Displaying a null value as 0
    By jordanturner in forum Access
    Replies: 2
    Last Post: 09-17-2010, 09:22 AM
  5. Displaying data in Access from SQL
    By BeckyAccess in forum Queries
    Replies: 0
    Last Post: 06-30-2009, 01:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums