Query to select unique seasons

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Query to select unique seasons

    Hi,

    Could someone please tell me what the select statement for MSACCESS would be
    to select the number of times a player appears in the following table, where
    the season is unique. Eg. If a player plays in two teams in one season we only
    want to count that row once....


    Player / team / season
    1 / 1 / 1
    1 / 2 / 1
    2 / 1 / 1
    3 / 1 / 1
    1 / 1 / 2
    2 / 1 / 2
    2 / 2 / 2

    In the above, player one plays in 2 seasons (this is the result I'm after),
    but played in 3 teams over the two seasons.

    thanks
    Tanya

    Rustywater Guest

  2. Similar Questions and Discussions

    1. Unique Form inserting into many tables using unique id
      I have a Registration Form that have 3 steps. The data could be inserted into many (4) tables. Some data corresponding to a one table (the main or...
    2. summing data based on football seasons
      Hi, I have 3 tables season, fixture and scorers. season is defined as: seasonID int(11) name varchar(20) with data like:
    3. Query of Query to select a title first letter
      The column "title" exists in a normal query. Need to select the first letter of the titles to build a list for a prev-next alphabetical search. ...
    4. Using < and > in a select query
      I am trying to write a select query to recieve results between two date ranges i have got these lines in my cfquery tag (example): and...
    5. Select after insert to the unique column
      On Wed, Dec 08, 2004 at 14:50:04 +0100, Julian Legeny <legeny@softhome.net> wrote: Depending on what you really want to do, you could do each...
  3. #2

    Default Re: Query to select unique seasons

    SELECT COUNT(DISTINCT Season) WHERE Player = [your value here]
    gwgiswebmaster Guest

  4. #3

    Default Re: Query to select unique seasons

    I had actually tried that, as well as just SELECT COUNT(season) from players
    where player=#player#, which only ever returns a value of 1. But when trying
    the above suggestion script dies with "Syntax error (missing operator) in query
    expression &apos;COUNT(DISTINCT season)&apos;. "

    Tanya

    Rustywater Guest

  5. #4

    Default Re: Query to select unique seasons

    This works..

    select DISTINCT <column> from <table> where <x> = <y>
    Rustywater Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139