Hi there,
I use a fulltext-index for searching my database.
The old query searched only in a table called 'user'. The old query was no problem, but now there another table I need to search too.
First my original query:
SELECT * FROM
tbl_user
WHERE MATCH (name, strasse, beschreibung, suchbegriffe) AGAINST ('$suchbegriffe' IN BOOLEAN MODE)
AND aid='$administrationId';
Now a user can have different branches, and this branches should be included in the search. And thats my problem, I dont't get it to work.
the tables:
tbl_user:
id|aid|name|phone|adress|country
the aid is the administration-id which the user belongs to.
tbl_branches
id|vid|thename
tbl_userrbranches
brancheid|userid
and the actual SQL-string which doesnt work correctly.
SELECT benutzer.name AS name
FROM
tbl_benutzer AS benutzer,
tbl_branchen AS bra,
tbl_benutzerbranchen AS bbra
WHERE MATCH
(bra.name, benutzer.name, benutzer.strasse, benutzer.beschreibung, benutzer.suchbegriffe)
AGAINST
('$suchbegriffe' IN BOOLEAN MODE) AND
benutzer.vid='$verwaltungId' AND
bra.vid ='$verwaltungId' AND
bra.id = bbra.branchenid;
I hope you can help me out,
thx in adavance,
greets ben
I use a fulltext-index for searching my database.
The old query searched only in a table called 'user'. The old query was no problem, but now there another table I need to search too.
First my original query:
SELECT * FROM
tbl_user
WHERE MATCH (name, strasse, beschreibung, suchbegriffe) AGAINST ('$suchbegriffe' IN BOOLEAN MODE)
AND aid='$administrationId';
Now a user can have different branches, and this branches should be included in the search. And thats my problem, I dont't get it to work.
the tables:
tbl_user:
id|aid|name|phone|adress|country
the aid is the administration-id which the user belongs to.
tbl_branches
id|vid|thename
tbl_userrbranches
brancheid|userid
and the actual SQL-string which doesnt work correctly.
SELECT benutzer.name AS name
FROM
tbl_benutzer AS benutzer,
tbl_branchen AS bra,
tbl_benutzerbranchen AS bbra
WHERE MATCH
(bra.name, benutzer.name, benutzer.strasse, benutzer.beschreibung, benutzer.suchbegriffe)
AGAINST
('$suchbegriffe' IN BOOLEAN MODE) AND
benutzer.vid='$verwaltungId' AND
bra.vid ='$verwaltungId' AND
bra.id = bbra.branchenid;
I hope you can help me out,
thx in adavance,
greets ben