教一个SQL语句 本帖最后由 lonsoft 于 2011-10-23 00:00:12 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select pidfrom 表结构如下where did in (1,5,6)group by pidorder by count(*) 谢谢 ACMAIN_CHM :)不要用IN 吧。效率太低了。因为这个表有超过几百万条的数据。。 http://topic.csdn.net/u/20090626/16/65f043cf-b9d9-4707-b660-9857461177f4.htmlMySQL 中 where id in (1,2,3,4,...) 的效率问题讨论 select pidfrom (select pid from TEST where did=5 union allselect pid from TEST where did=6union allselect pid from TEST where did=1)group by pidorder by count(*) DESC用这种会不会效率高点呢? 另外请教一个问题,mysql 如果存在就不插入,用什么语句效率最高呢? :) insert igonre ,如果主键冲突,则不会插入。 谁可以推荐下MYSQL入门书籍啊。 alibaba mysql dba面试题,看看你会不会? 火车订票系统的数据库怎么设计? 关于MySql列别名做查询条件的问题 在命令窗口下查询的中文数据显示出乱码,怎么纠正? LOAD DATA INFILE 如何跳过空行? 用MySql-Front建表,如何建立一个有默认当前时间的字段? 数据库连接不上,帮忙看看!谢谢 回复那位 shuixin13(犬犬(心帆)高手 MYSQL中怎样储存二进制文件 两个200w的表联合查询,如果有字符串相等的条件,我是不是要先查出来再程序判断字符串是不是相等 求助一条mysql语句
from 表结构如下
where did in (1,5,6)
group by pid
order by count(*)
http://topic.csdn.net/u/20090626/16/65f043cf-b9d9-4707-b660-9857461177f4.html
MySQL 中 where id in (1,2,3,4,...) 的效率问题讨论
from (
select pid from TEST where did=5
union all
select pid from TEST where did=6
union all
select pid from TEST where did=1
)
group by pid
order by count(*) DESC用这种会不会效率高点呢?
另外请教一个问题,mysql 如果存在就不插入,用什么语句效率最高呢? :)