标签:course ons stack mysql ber color div for lis
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'’
标签:course ons stack mysql ber color div for lis
原文地址:http://www.cnblogs.com/wanghaonull/p/6848442.html