Solved

MySQL Query

Posted on 2013-06-14
2
319 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 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39249208
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
ID: 39249234
My error, I had forgotten they used the uid field from student.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

680 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