0
我需要的时限内取重复记录如何在MySQL中查询查询结果集?
我的表是
id designation company pdate location
1 d1 c1 31-1-2014 delhi
2 d3 c1 2-2-2014 delhi
3 d5 c5 1-2-2014 chennai
4 d1 c1 12-2-2014 delhi
5 d2 c2 1-2-2014 chennai
6 d3 c1 2-2-2014 delhi
7 d3 c1 3-2-2014 delhi
8 d4 c2 2-2-2014 chennai
9 d5 c3 4-2-2014 delhi
10 d1 c4 5-2-2014 chennai
11 d1 c4 1-2-2014 delhi
12 d3 c1 2-2-2014 chennai
13 d2 c3 3-2-2014 delhi
14 d5 c5 1-2-2014 chennai
SELECT * FROM mytable WHERE pdate BETWEEN '1-2-2014' AND '2-2-2014'group by designation, company,location order by pdate ASC, designation ASC, company ASC, location ASC
现在我拿来记录
id designation company pdate location
3 d2 c2 1-2-2014 chennai
4 d3 c1 2-2-2014 delhi
8 d4 c2 2-2-2014 chennai
11 d1 c4 1-2-2014 delhi
12 d3 c1 2-2-2014 chennai
14 d5 c5 1-2-2014 chennai
,现在的每一行获取我要查询重复的(对于价值指定,公司,地点)记录在同一张表
所以我最终的输出将是
id designation company pdate location
2 d3 c1 2-2-2014 delhi
5 d2 c2 1-2-2014 chennai
6 d3 c1 2-2-2014 delhi
7 d3 c1 3-2-2014 delhi
8 d4 c2 2-2-2014 chennai
10 d1 c4 5-2-2014 chennai
12 d3 c1 2-2-2014 chennai
14 d5 c5 1-2-2014 chennai
所以,在我最后的结果我所有的日期2014年1月2日之间,以2014年2月2日,并与desination,公司,任何日期的位置重复值的记录从过滤日期值也记录