A bit complicated SQL question here.
I currently have a SELECT statement that matches multiple fields, for example:
SELECT field1, field2, field3, field4, field5
FROM table
WHERE field1 = 'variable 1'
AND field2 = 'variable 2'
AND field3 = 'variable 3'
AND field4 = 'variable 4'
AND field5 = 'variable 5'
I would like to change the statement so that it uses OR instead of AND, so that it selects all records that match any of the fields.
The next step is to rank the results using the scoring system.
If field 1 was matched then 1000 is added to the score
If field 2 was matched then 800 is added to the score
If field 3 was matched then 600 is added to the score
If field 4 was matched then 10 is added to the score
If field 5 was matched then 1 is added to the score
So...
Match 1 - If field 2 and field 3 match, the score will be 1400
Match 2 - If field 1 and field 4 match, the score will be 1010
Match 1 will be at the top of the results.
Any help with some SQL to achieve this will really be appreciated.