mysql> desc test1
-> ;
+-------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------------+------+-----+---------+----------------+
| id | int(11) unsigned | NO | PRI | NULL | auto_increment |
+-------+------------------+------+-----+---------+----------------+
mysql> desc test2;
+---------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+------------------+------+-----+---------+----------------+
| id | int(11) unsigned | NO | PRI | NULL | auto_increment |
| ids_str | varchar(32) | YES | | NULL | |
+---------+------------------+------+-----+---------+----------------+
ids_str是一个字符串。
ids_str="1,2,3"
select * from test1 where id in (select ids_str from test2)
即:
select * from test1 where id in ("1,2,3")
最后
以上就是冷酷小猫咪最近收集整理的关于mysql ids查询_mysql where in (select ids_str from test)如何查询的全部内容,更多相关mysql内容请搜索靠谱客的其他文章。
发表评论 取消回复