I have below table structure:
cv1 cv2 cv_content1 cv_content2
abc xyz php,mysql sql dotnet
aaa xxx java php is my skill
I have two keywords lets say php and dotnet. Now I want to fetch record from above table t1 with two previous mentioned keywords in column cv_content1 and cv_content2 with OR condition. I want below records:
cv1 cv2
abc xyz
--- xxx
I tried case statement and if also and I also have to check that how many keywords match for a record for example for first row of result it is 100%(php and dotnet both are in row) but for second row it is 50%(only php matched).
I tried below query so far:
SELECT ROUND(( ( if(LOCATE("php",cv_content1 )>0,25,0) OR if(LOCATE("php",cv_content2 )>0,25,0) ) + if(LOCATE("dotnet",cv_content1 )>0,25,0) OR if(LOCATE("dotnet",cv_content2 )>0,25,0) ) * 100 ) / 50) as SkillTot,if (own_content regexp '[[:<:]]smith[[:>:]]',`own_filename`),if (kings_content regexp '[[:<:]]smith[[:>:]]' ,`kings_filename`) FROM `t1`WHERE ( cv_content1 REGEXP '[[:<:]]php[[:>:]]' OR cv_content2 REGEXP '[[:<:]]php[[:>:]]' OR cv_content1 REGEXP '[[:<:]]dotnet[[:>:]]' OR cv_content2 REGEXP '[[:<:]]dotnet[[:>:]]')
It has a syntax error also. Don't understand how to use if statement