Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005

    Unanswered: type mismatch in expression

    I'm using DB to run a small poker league. My DB setup is:

    players - player_id (autonumber), player_name (text)
    tourn - tourn_id (autonumber), venue (text), entry_fee (number, currency), tourn_date (date/time, medium date), n_entrants (number, integer<>0)
    status - status_id (autonumber), player_name (from players table), tourn_id (from tourn table), position (number, integer<>0), winnings (number, currency)

    I'm trying to create a query, that groups by player name, the count of tourn_id, victories (count of position=1), cash_prizes (count of winnings>0), sum of winnings, sum of entry_fee, net winnings (sum of winnings - sum of entry_fee)

    With the help of truittb (the one who signs Fiat Lux), I get this, but I keep getting error msg "type mismatch in expression"

    SELECT P.player_name, Count(T.tourn_id) AS CountOftourn_id, Sum(S.winnings) AS SumOfwinnings, Sum(T.entry_fee) AS SumOfentry_fee, (SELECT Count(position) FROM status WHERE position =1
    AND status.player_name= P.Player_Name) AS victories, (SELECT Count(winnings) FROM status WHERE winnings>0
    AND status.player_name= P.Player_Name) AS Cash_prizes
    FROM tourn AS T INNER JOIN (players AS P INNER JOIN status AS S ON P.player_name=S.player_name) ON T.tourn_id=S.tourn_id
    GROUP BY P.player_name;

    What's wrong with the above?

    Thanks a lot


  2. #2
    Join Date
    Nov 2005
    That error generally means that you are trying to put the wrong type of data into a field. For instance, you could be trying to put text into a numeric field.
    Programming/Web Design

    Offer solutions-not criticism.

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    agree with the meaning of mismatch usually you aretrying to use a string as a number or viceversa

    just a quick comment you are linking on playername not player id. Ber in mind that some people may choose to change their name

Posting Permissions

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