SELECT fileid FROM files
WHERE description LIKE '%%%s%%' OR filename LIKE '%%%s%%' OR uploader LIKE '%%%s%%'
ORDER BY fileid DESC\" % (search, search, search)
具体⽰例
def find_info_by_param(self, conn,Title,Organization,InfoType ,PubDate1,PubDate2,offsetnum,limitnum): '''
根据众多条件返回检索结果,其中包含了mysql的like查询 :param conn: :param Title:
:param Organization: :param InfoType: :param PubDate1: :param PubDate2: :param offsetnum: :param limitnum: :return: '''
self.conn = conn result = 0 try:
curr = conn.cursor()
sqlStr = \" select Id,Title,PubDate,Organization,EffectDate,Content,Url,IndexNum,`Type`,PolicyNo,Effect,Keyword,Abstract,InfoType,Creator,CreateTime from Policys where Title like '%%%s%%' and Organization like '%%%s%%' and In print(sqlStr) # args =()
curr.execute(sqlStr) rows = curr.fetchall() return rows
except pymysql.Error as e:
print('find_policy_by_id error %s' % e) conn.close() return result
因篇幅问题不能全部显示,请点此查看更多更全内容