Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8028811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:14:16+00:00 2026-06-05T00:14:16+00:00

I have some sort of evaluating application in the making, it’s almost finished but

  • 0

I have some sort of evaluating application in the making, it’s almost finished but I’m stuck with rather complicated SQL query.

To start with here are linked tables I am using (MySQL):

table1: USERS (list of users)

userID | name | surname | email


table2: EVENT (list of events)

eventID | event_typeID | event_name | event_description


table3: EVENT_TYPE (list of event types, each has number of points that a person gets if it’s involved in it)

event_typeID | number_of_point


table4: USER_EVENT (list of user and event ID’s with multiplication factor)

user_eventID | userID | eventID | factor


Function to get needed data is, let’s say: function getUsersWithPoints($number_of_points_for_threshold)


What it needs to do is get name, surname, emailn total sum of points and all EVENTs user has been to for all users which have total number of points in events equal or greater than $number_of_points_for_threshold, but data must be taken indirectly, without getting it in another table.

Thanks in advance.


  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:14:18+00:00Added an answer on June 5, 2026 at 12:14 am

    First I’m assuming that USER_EVENT has the event_typeID as a column. I can’t where event_typeID is referenced anywhere else. Try something like this:

    SELECT name, surname, email, sum(number_of_point) 
    FROM user, user_event, event_type 
    WHERE user.userID = user_event.userID AND user_event.event_typeID = event_type.event_typeID 
    GROUP BY user.userID
    HAVING sum(number_of_point) > :threshold
    ORDER BY name ASC
    

    Make sure you have indexes on user_event.userID and user_event.event_typeID a

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some sort of recursive function, but I need to parse a string,
I have some sort of a design problem with my Django AJAX application. I
Right now i have some sort of services application on windows server 2003 for
I have some sort of problem, when it comes to customizing the iPad-launch-lcreens of
I have some sort of a jquery chat at one specific PHP page. Of
Does anyone happen to have some sort of a nice command line script they
Is it possible to have some sort of template where a certain column (lets
Introduction I have some sort of values that I might want to access several
I think I've configured Box2d to have some sort of maximum velocity for any
One of the huge benefits in languages that have some sort of reflection/introspecition is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.