ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
- 简单查询 ~~~ set names utf8; 设置编码 select * from biao 基本查询 select distinct id from biao 结果字段不重复 select * from biao order by id desc ,time asc; 升序降序 select * from biao group by sex having; 分组筛选 select * from biao limit 4 返回4条 select * from biao 4,3 返回3条,从第5条记录开始 select a,b,c from A inner join B on A.id = B.id; 内连接 select a,b,c from A,B where A.id=B.id;内连接 select * from A left join B on A.id=B.id; 左连接 select * from A right join B on A.id=B.id;右连接 select id from Table where id2 in(select id3 from Table2) 子查询 select id from Table where find_in_set(type,"ssq,sd,pls") 查询分类 select id as ID from A as a 别名 select * from A union all select * from B 合并结果集 select * from A union select * from B 去重复 SELECT id,title FROM article WHERE id<$id ORDER BY id desc LIMIT 1 上一篇 SELECT id,title FROM article WHERE id>$id ORDER BY id ASC LIMIT 1 下一篇 select count(distinct openid) as total from TB 统计记录去重复 ~~~