# SQL Multi Table search

**URL:** <https://forum.kirupa.com/t/sql-multi-table-search/216067>\
**Category:** programming\
**Created:** [February 13, 2007, 2:28pm UTC](https://forum.kirupa.com/t/sql-multi-table-search/216067 "2007-02-13T14:28:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![am\_developer](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@am\_developer](https://forum.kirupa.com/u/am_developer)\
**Post date:** [February 13, 2007, 2:28pm UTC](https://forum.kirupa.com/t/sql-multi-table-search/216067/1 "2007-02-13T14:28:02Z")

</div>

I am using the following code to search 4 tables and return a relevance result for each table. I am wondering how I can now add up the scorePeople, scoreReview, scoreFilm and scoreGenre results to obtain one overall result…

SELECT films.ID, films.film\_title,  
MATCH(films.film\_title, films.synopsis, films.trivia, films.awards) AGAINST(‘action’) AS scoreFilms,  
MATCH(people.first\_name, people.surname) AGAINST(‘action’) AS scorePeople,  
MATCH(reviews.review\_text) AGAINST(‘action’) AS scoreReview,  
MATCH(genres.genre\_name) AGAINST(‘action’) AS scoreGenre  
FROM films INNER JOIN index\_films\_genres ON films.ID = index\_films\_genres.film\_ID  
INNER JOIN index\_films\_people ON films.ID = index\_films\_people.film\_ID  
INNER JOIN reviews ON reviews.ID = films.ID  
INNER JOIN people ON index\_films\_people.person\_ID = people.ID  
INNER JOIN genres ON index\_films\_genres.genre\_ID = genres.ID  
WHERE MATCH(films.film\_title, films.synopsis, films.trivia, films.awards) AGAINST(‘action’)  
OR MATCH(people.first\_name, people.surname) AGAINST(‘action’)  
OR MATCH(reviews.review\_text) AGAINST(‘action’)  
OR MATCH(genres.genre\_name) AGAINST(‘action’)  
ORDER BY scoreFilms DESC

Thanks in advance Alex
