我是靠谱客的博主 冷酷小猫咪,这篇文章主要介绍mysql ids查询_mysql where in (select ids_str from test)如何查询,现在分享给大家,希望可以做个参考。

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内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(131)

评论列表共有 0 条评论

立即
投稿
返回
顶部