Hey guys,
I'm developing a MySQL database of files for a few fileservers we have on this network. A program scours the 10 or so computers and archives the files into a huge database that's split into 4 tables: etc, video, audio, and images; I did this to increase search speeds. What I want to do is know how to search the four tables at once. Say the tables are all this:
create table index_etc (
id INT DEFAULT 0 NOT NULL AUTO_INCREMENT,
host VARCHAR(64), // computer name
dir VARCHAR(128), // directory
filename VARCHAR(255), // filename
primary key(id)); // index
Each table is like that, but say I want to search for any folders with "bacon" in them. I tried doing this:
SELECT host,dir FROM index_etc e, index_video v (etc.) WHERE e.dir LIKE "%bacon%" OR v.dir LIKE "%bacon%" OR ... etc. When it doesn't give me an error, the search takes forever as I think it's doing some infinite search. Does anyone know how I can do a search that will go through the first table, find results, then hit the second, etc., and return say 50 results at a time? Basically a normal search but scaled over multiple tables?
Thanks a lot!!
Mike