For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > April 2004 > Searching multiple fields in multiple tables









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Searching multiple fields in multiple tables
Floortje

2004-04-27, 1:13 am

Hi I got a database setup something like this (altually it has alot more
fields like teacher.resume courses.description courses.intro etc etc etc)

courses
courses.id
courses.description
courses.location

teachers
teachers.id
teachers.name
teachers.id_courses

location
location.id
location.name
location.route
location.id_courses


now how could I search all these fields the best way ... ive tried

SELECT courses.name, teacher.name, location.name
FROM courses, teachers,location
WHERE courses.id like 'blaat'
OR courses.description like 'blaat'
OR courses.location like 'blaat'
AND location.id_courses=courses.id
AND teachers.id_courses=courses.id

but that gives me lotsa same results and take forever with only 300 db
entries

I dont mind figuring out the hard part myself but please tell me where to
look

Floortje

--
Check out King Louie
www.kinglouie.tk


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com