In Progress

382917 Fix my MySQL query

I need someone to provide me with the proper MySQL syntax for the query described below.

When running my current query code (listed below), I'm receiving the following error in MySQL:

[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') and [url removed, login to view] = [url removed, login to view](+) and [url removed, login to view] = [url removed, login to view](' at line 13

### My query code:

SELECT [url removed, login to view], student_name, count_of_tests_started_by_student, count_of_tests_failed_by_student,

count_of_tests_passed_by_student, count_of_tests_currently_incomplete_by_student

FROM

( SELECT COUNT(*) AS count_of_tests_started_by_student, studentID FROM test GROUP BY studentID ) AS T1,

( SELECT COUNT(*) AS count_of_tests_failed_by_student , studentID FROM test WHERE test_result = 'failed' GROUP BY studentID ) AS T2,

( SELECT COUNT(*) AS count_of_tests_passed_by_student , studentID FROM test WHERE test_result = 'passed' GROUP BY studentID ) AS T3,

( SELECT COUNT(*) AS count_of_tests_incomplete_by_student , studentID FROM test WHERE test_result = 'incomplete'

GROUP BY studentID ) AS T4 ,

student

where

[url removed, login to view] = [url removed, login to view](+) and [url removed, login to view] = [url removed, login to view](+) and [url removed, login to view] = [url removed, login to view](+)

and [url removed, login to view] = [url removed, login to view](+)

Here's the details for what I need:

i have two myisam mysql tables (student and test). i need the query to return a row for every student in the student table and each returned row should contain the following columns:

* studentID

* student_name

* count_of_tests_started_by_student

* count_of_tests_failed_by_student

* count_of_tests_passed_by_student

* count_of_tests_currently_incomplete_by_student

The STUDENT table contains:

* studentID primary key (1234)

* student_name (john doe)

The TEST table contains:

* testID primary key (1234)

* studentID (1234)

* test_result ("passed", "failed", "incomplete")

Each student may have any number of TEST table records (zero or more).

In my quest to debug the error in my query code, I've tried to get the following simpler query code to work. But, I can not even get the following query to work without getting the MySQL syntax error message:

SELECT [url removed, login to view], student_name

FROM

test ,

student

where

[url removed, login to view] = [url removed, login to view](+)

Skills: Anything Goes, MySQL, SQL

See more: n query, sql mysql, query table, mysql test, mysql query, my sql work, fix mysql query, mysql number sql, error query 1064, mysql running, fix query, sql syntax error, mysql sql syntax, fix code debug, sql test number, sql student, sql syntax, error 1064, mysql error 1064, code quest, fix debug, primary key, sql error 1064 mysql, 1234, mysql server error

About the Employer:
( 12 reviews ) lawrenceburg, United States

Project ID: #2128766

Awarded to:

softechblr

can be done.

$15 USD in 1 day
(0 Reviews)
0.0