首页 > 代码库 > mysql 报错 ‘u'Subquery returns more than 1 row'’
mysql 报错 ‘u'Subquery returns more than 1 row'’
watch_course_sql = """select DATE_FORMAT( FROM_UNIXTIME(a.CreateTime / 1000) , ‘%%Y-%%m-%%d %%T‘) regtime, a.username FROM bskuser a where a.UserName in (select username from bskchapterlist where lessonid = (select id from bsklesson a WHERE a.lessonname like \‘%s\‘) ) limit %d,50 """ % (coursename, page*50)
前台传来的coursename应该是汉字 但是如果错误传来number的时候 后台会报错 ‘u‘Subquery returns more than 1 row‘’ 只需在在相关的位置加个any就行啦
最终的sql语句
select DATE_FORMAT( FROM_UNIXTIME(a.CreateTime / 1000) , ‘%Y-%m-%d %T‘) regtime, a.username username FROM bskuser a where a.UserName in (select username from bskchapterlist where lessonid = ANY (select id from bsklesson a WHERE a.lessonname like ‘%2%‘) )
相关资料:http://stackoverflow.com/questions/778239/mysql-subquery-returns-more-than-one-row
mysql 报错 ‘u'Subquery returns more than 1 row'’
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。