![](/img/trans.png)
[英]How to fetch the records based on the no of occurences of a value in certain field in MySQL?
[英]how to fetch the records based on value is exist in the column or not in mysql?
該數據是從某些emp表中獲取的:--->“ php,codeigniter,seo,html,javascript,techsupport,html,hr,finance
”
這是基於上述數據的我的問題
下表(如果有任何字符串匹配上述數據中的技能),則顯示該ID
表:
id skill
---------------------
1 php
2 php,hr
3 javascript,html,seo
4 sap
5 oracleapps
結果應該只顯示1,2,3行,才有可能獲取該數據?
我正在使用此查詢,但僅獲取完全匹配記錄
select * from seekerdetails jsd
where find_in_set( jsd.key_skills,( select lower( GROUP_CONCAT(key_skills))
from
empjobs))
首先,展開您的$table
列表,然后將其一個一個地添加到FIND_IN_SET
調用中:
$t = explode(",",$table);
$q = "SELECT * FROM seekerdetails WHERE ".
"FIND_IN_SET(".implode("', key_skills) OR FIND_IN_SET('", $t).", key_skills)";
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.