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

  • Home
  • SEARCH
  • 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 9028691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:03:11+00:00 2026-06-16T07:03:11+00:00

there is a sql query problem in which i should find out which users

  • 0

there is a sql query problem in which i should find out which users have passed all of the tests.
here are the tables:

ex: nameoftable(nameofcolumns)

user(userid,password)

test(test#,creditpertrue,negperfalse,total,neededcredit)

{creditpertrue=points given per a right answer and negperfalse=points taken per a wrong answer
and total=is the total points of a test and neededcredit is the points to pass the test}

question(test#,q#,truechoice#)

user_test(userid,test#)

{this table shows that which user have taken which test(a user can only take a test once)}

user_test_question(uesrid,test#,q#,userchoice#)
{this table shows the choice of every user in every test and question# which may be wrong or right}

now the question is this:
find out the userid of users that have passed all of the tests.

a solution that came to my mind was this:

create 2 views like this:
view1:userid,test#,numberofrightchoices

and

view2:userid,test#,numberofwrongchoices

and then use a select on these 2views and use numberofrightchoices*creditpertrue-numberofwrongchoices*negperfalse>=neededcredit

is it possible?

  • 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-16T07:03:12+00:00Added an answer on June 16, 2026 at 7:03 am

    I think that the query that you need to get a list of users who have passed all the tests would be this:

    select userid,
    from user_test
    where userid not in (
        Select 
            userid
        from    
            (select t0.test#,t2.uesrid, neededcredit,
                Sum(case when t1.truechoice# = userchoice# then t0.creditpertrue else -negperfalse end) as User_Test_Points
            from test t0 left join   
                question t1 on (t0.test# = t1.test#) left join
                    user_test_question t2 on (t1.q# = t2.q#)
            where t2.uesrid is not null
            Group by t0.test#,t2.uesrid,neededcredit )
        Where Test_Results.User_Test_Points < Test_Results.neededcredit ) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SQL query which select the record from three tables and there is no relation
I am facing a problem for writing an sql query which should be easy
I have a Microsoft SQL Server 2008 query that returns data from three tables
Is there a SQL command that will list all the tables in a database
I'm trying for hours to find out the correct SQL query to select the
I have a Python function which receives numerous variables, and builds an SQL query
I have spent several hours with this SQL problem, which I thought would be
I have a SQL SELECT query which has a LIKE clause containing an underscore,
I have a query which uses an array of tables (stored as a string
Is there a possibility to speedup a SQL-query like the following one? SELECT.... FROM

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.