(数据库执行效率高)
select * from dbo.MediafileInfo as a where
(VideoDownUrl IN (SELECT VideoDownUrl FROM MediafileInfo AS B WHERE A.ProgramID <>B.ProgramID))
(数据库执行效率低)
SELECT *
FROM MediafileInfo AS A
WHERE (SELECT COUNT(*) FROM MediafileInfo WHERE VideoDownUrl=A.VideoDownUrl)>1
select distinct biao.idfrom biao
left outer join (select col1, col2
from biao
group by col1, col2
having count(*) >1) tmp
on biao.col1 = tmp.col1
and biao.col2 = tmp.col2
补充回答:group_concat函数有大小限制,缺省是1024,你可以根据自己的要求修改这个大小,有两种方法
1.在MySQL配置文件中加上
group_concat_max_len = 102400 #你要的最大长度
2.可以简单一点,执行语句:
mysql>SET GLOBAL group_concat_max_len=102400
Query OK, 0 rows affected (0.01 sec)
具体的可以看参考资料的连接
mysql可以使用group_concat函数了,以下语句在mysql5中测试通过
select phid,group_concat(adress order by adress separator " ") as adress
from dz_tupian
group by phid
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)