[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

MySQL Query

What is wrong with this:

SELECT student.sid, test_results . *
FROM student
INNER JOIN test_results ON student.sid = test_results.ID
WHERE student.district_code = 'OSD'

Attached are the structures of both tables.

There are 6899 records in student where district_code = 'OSD'.

My guess is there are about 500K records in test_results that meet these criteria. The query result says returned zero.
student-table.jpg
test-results.jpg
0
Richard Korts
Asked:
Richard Korts
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
I think 'test_results.ID' should be 'test_results.id' and there shouldn't be any spaces in 'test_results.*'.
SELECT student.sid, test_results.*
FROM student
INNER JOIN test_results ON student.sid = test_results.id
WHERE student.district_code = 'OSD'

Open in new window

0
 
Richard KortsAuthor Commented:
My error, I had forgotten they used the uid field from student.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now