使用 WITH ROLLUP:
正则表达式:
order by rand()随机抽取几个
mysql中查询一个字段具体是属于哪一个数据库的那一张表:
select table_schema,table_name from information_schema.columns where column_name = '字段名'
根据另一张表中字段更新本表:
update xx_v v,xx_g g set v.cate = g.cate where g.id = v.r_id
查询字段中包含反斜杠\:
select * from xx_goods where items like '%A\\\\M%'
select * from xx_goods where items like '%\\\%'或select * from xx_goods where items like '%\\\\%'
hql查询条件中模糊搜索忽略大小写和空格,以及处理字段本身包含单引号的情况:
String yuan = "Neal's Yard Remedies";
String name =yuan.replaceAll("'", "''");
String hql="select name from table_name where replace(name,' ','') like replace(\'%"+name+"%\',' ','');
查询出的数据带序号:
select (@i:= @i+1) as rownum,o.created_date from table o,(select @i:= 0) a