【mysql】mysql常用语句

时间:2022-09-26 20:01:48

返回不重复数据

SELECT DISTINCT user_name,vistor_username  FROM KY_FEED_VISTOR WHERE user_name='shenhy'  

单独的distinct只能放在开头 而且distinct()里面只能包含一个字段

SELECT *  FROM KY_FEED_VISTOR WHERE user_name='shenhy'  GROUP BY user_name, vistor_username  ORDER BY  vistor_time DESC

创建一个新表且新表的结构与查询的表的结构是一样,不过没有索引

create newTable newtable as =;