求教去除重复语句优化
现在有个mysql数据库的 ProductList表,简化如下:
ID Product createtime
1001 洗衣机 2016/10/1 0:00
1002 电饭煲 2016/10/2 0:00
1003 电饭煲 2016/10/2 0:00
1004 电饭煲 2016/10/3 0:00
110001 电视机 2016/10/5 0:00
1200001 电视机 2016/10/5 0:00
我想 select product from ProductList 得到的结果是:
洗衣机
电饭煲
电视机
因为表的数据有几千万条,用了如下三种写法都不行 ,请教高手我该如何写优化语句
select distinct product from ProductList
select product from ProductList group by product
select product from ProductList group by product having count(product) > 1