我有这张桌子:
------------------------------
|ID | name | employee_code |
------------------------------
|24 | Robert | 20234 |
------------------------------
和
-------------------------------------
|ID | job_code | team |
-------------------------------------
|24 | 241124 | Robert, Eduard, Etc. |
-------------------------------------
我想按员工代码在第二个表中搜索,我尝试这样的事情:
$sql=mysql_query("SELECT * FROM works WHERE (SELECT name FROM employee WHERE employee_code LIKE '%".$_GET['employee_code']."%' AS searchname) team Like %searchname% ");
结果:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource