Solved

MySQL Query

Posted on 2013-06-14
2
314 Views
Last Modified: 2013-06-14
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
Comment
Question by:Richard Korts
2 Comments
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
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
 

Author Comment

by:Richard Korts
Comment Utility
My error, I had forgotten they used the uid field from student.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now