Keywords database searching 5+ tables
I have tried regular expressions such as `SELECT * FROM addresses WHERE LOWER(`address`) REGEXP '\b(keyword_a|keywords_b|keyword_c)\b'` and other queries like using `WHERE `addresses` LIKE '%$keyword%'` but none seem to work correctly.

I have been advised to create a keyword database but the idea is: you have tenants, tenancy agreements, properties and landlords and the bank statements are imported as a CSV file and uploaded into another table.

I need the code to read each line of the statement and try to match that description/amount of the statement to someone, so a tenant for example.  Bank statements can differ from having part of the address to having the persons name on, as well as maybe even having a partial amount for the rent.

If I were to create a keywords database, how would I go about doing this? As there would be lots of matches to a name of a road for example.  Relevance might work but some part of the statements may have random numbers in that might be treated as a key word that would add up more than the real result.

I am starting again with this:

    //$a = date, $b = type (BACS, Transfer, etc), $c = description, $d = amount (£)

    function reconcile($a,$b,$c,$d) {
	
	    //break down the inputs into an array
	    //create SQL query that matches all of these key words
	
	    //create keywords database
	
	    $keywords = explode(" ", trim($a . " " . $b . " " . $c . " " . $d));

        //mysql_query() add up results that match and MAX() relevance
        //according to how many results are found.
    }

Any suggestions how to tackle this correctly?
Keywords database searching 5+ tables
===

I have tried regular expressions such as `SELECT * FROM addresses WHERE LOWER(`address`) REGEXP '\b(keyword_a|keywords_b|keyword_c)\b'` and other queries like using `WHERE `addresses` LIKE '%$keyword%'` but none seem to work correctly.

I have been advised to create a keyword database but the idea is: you have tenants, tenancy agreements, properties and landlords and the bank statements are imported as a CSV file and uploaded into another table.

I need the code to read each line of the statement and try to match that description/amount of the statement to someone, so a tenant for example.  Bank statements can differ from having part of the address to having the persons name on, as well as maybe even having a partial amount for the rent.

If I were to create a keywords database, how would I go about doing this? As there would be lots of matches to a name of a road for example.  Relevance might work but some part of the statements may have random numbers in that might be treated as a key word that would add up more than the real result.

I am starting again with this:

    //$a = date, $b = type (BACS, Transfer, etc), $c = description, $d = amount (£)

    function reconcile($a,$b,$c,$d) {
	
	    //break down the inputs into an array
	    //create SQL query that matches all of these key words
	
	    //create keywords database
	
	    $keywords = explode(" ", trim($a . " " . $b . " " . $c . " " . $d));

        //mysql_query() add up results that match and MAX() relevance
        //according to how many results are found.
    }

Any suggestions how to tackle this correctly?