十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
你是要查找数据库中某个字段下的相同数据吧,我给你写2个例子
成都地区优秀IDC服务器托管提供商(创新互联建站).为客户提供专业的成都多线服务器托管,四川各地服务器托管,成都多线服务器托管、多线服务器托管.托管咨询专线:028-86922220
(数据库执行效率高)
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 name,sum(num) from table group by name
--group by 分组查询可以实现,根据名称分组查询累加数量
title = 123_456 abcdef
你如果是要title内字母前的所有值,可以这样写:
SELECT SUBSTRING_INDEX(title, ' ', 1)
效果如下:
select * from tableName where (bookname,borrowtime) in (select bookname,borrowtime from tableName group by bookname,borrowtime having count(*) 1);