Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002
    Location
    Kyiv, Ukraine
    Posts
    77

    Unanswered: need some complicated query

    Looking for solution to following problem which looks quite easy drom the first sight but not not that one when I looked deeper into it .... :

    Have a table ""results" where following fields present:
    - user_id
    - tour_id
    - points

    and

    "tours"
    - tour_id
    - date

    (it's for some online gaming purposes)

    And I need to get the recordset:
    - user_id
    - score

    Where score is the SUM of 5 maximum results in results.points.

    Any idea or maybe just a point of view in which direction to dig? Because as for now I don't see any other solution except to launching separate query for on "resutls" table for every user and then building needed recordset from that data ...
    Yours faithfully,
    Yaroslav Zaremba

  2. #2
    Join Date
    Sep 2002
    Location
    Kyiv, Ukraine
    Posts
    77
    I guess I should simplify the task to the following:

    we have table "results":
    - user_id
    - tour_id
    - points

    where primary key (user_id, tour_id)

    and I need to get recordset where I will have:
    - user_id
    - score

    where primary key (user_id) and score = sum of maximum 5 elements from results.points for the user_id
    Yours faithfully,
    Yaroslav Zaremba

Posting Permissions

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