|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
MySQL error
I have a few tables and two of them are called teachers and teach. Teachers contain info about the teachers and teach contain the subjects which the teachers teach. When I do a query:
select * from Teachers where teach.subjectID=BM1; the result is this error:- Unknown table 'teach' in where clause what happened? can anyone enlighten me? Scumgrief |
|
#2
|
|||
|
|||
|
It's the 'from' bit...
You need to name all the tables involved in the query in the 'from' bit. Like this:
select * from Teachers, teach where teach.subjectID=BM1; Hope that helps, Jen ![]() |
|
#3
|
|||
|
|||
|
You should use ...
the relating ids from both tables in the WHERE clause as well, ie.
... WHERE teachers.id = teach.id AND teach.subjectID=BM1; btw: if the teach.subjectID is a character column you should consider smth. like that: ...WHERE ... AND teach.subjectID ='BM1' Hope that helps ![]() Quote:
__________________
---BP------------------------------------------- "Life is what happens, while you're makin' other plans..." |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > MySQL error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|