数据库
首页 > 数据库> > sql查询不在这个范围内的。例如,a不在b中出现的

sql查询不在这个范围内的。例如,a不在b中出现的

作者:互联网

 

 

 解释:此处查询id不在pid出现,以/qwe开头,userId为15的数据。子查询加上where是为了加快查询效率。

 

SELECT * from file where filePath like concat( "/qwe", '%') and userId =15 and  id NOT IN(SELECT pid from file where filePath like concat( "/qwe", '%') and userId =15)

 

标签:例如,15,qwe,userId,查询,file,sql,where
来源: https://www.cnblogs.com/bulter/p/15352532.html