我有这张桌子
Num | id1 | id2 | id3
---------------------------
1 | abc | sjs | hss
2 | abc | sjs | hss
3 | sjs | hss | uaj
4 | ahs | shh | ajs
5 | dks | sns | jaj
$user = "3";
$value = "hss";
我想检查USER行中是否存在VALUE(仅我想检查USER值前面的行而不是其他行或列)我该如何检查?
答案 0 :(得分:1)
执行您需要的简单查询;
SELECT *
FROM mytable
WHERE 'hss' IN (id1, id2, id3)
AND num <= 3;