// javascript document <!-- var nid=0; var tid=431; var mid=947; var full=1; var popdialogoptions = "dialogwidth:1000px; dialogheight:1000px; dialogtop:0px; dialogleft:0px; edge:raised; center:0; help:0; resizable:1; scroll:1; status:0"; var popwindowoptions = "scrollbars=1,menubar=0,toolbar=0,location=0,personalbar=0,status=0,resizable=1"; var doexit = true; var usepopdialog = true; var isusingspecial = false;
下面是我的一个库的部分结构 create table infomess ( infoid int(11) not null auto_increment, topic varchar(255) not null, …… email varchar(50), dateandtime datetime default '0000-00-00 00:00:00' not null, primary key (infoid) );
这里的dateandtime是标准的日期格式,然后我要查询5天内的记录,下面是sql查询语句 $sql="select * from infomess where to_days(dateandtime) >= (to_days(now()) - 5) order by infoid desc limit $offset,$psize";
<%on error resume next dim fso,wj,path,filepath,foldername,newfilename,targetpath wj="../index.html" path="/wenjian/" set fso=server.createobject("scripting.filesystemobject") filepath=server.mappath(wj)'得到源文件路径 foldername=server.mappath(".")&path'得到新目录a路径 newfilename="other.html"'得到保存到a目录的新文件名 targetpath=foldername&""&newfilename'得到新文件完整路径 if fso.folderexists(foldername) then'判断a目录是否存在 fso.copyfile filepath,targetpath,true else fso.createfolder(foldername)'创建a目录 fso.copyfile filepath,targetpath,true end if set fso=nothing'释放内存 if err then response.write err.description end if %>
select * from company where username in (select username from company group by username having count(username) > 1)
212397
select * from company where username ='212397'
-----------------------------
select username,count(*) from company group by username having count(*) > 1
delete from company where username in (select username from company group by username having count(username) > 1) and id not in (select min(id) from company group by username having count(username )>1)
delete from company where (username in (select username from company group by username having count(username) > 1)) and (id not in (select min(id) from company group by username having count(username) > 1))
============================================= 操作以下语句删除重复公司 create table tmp as select min(id) as col1 from company group by username; delete from company where id not in (select col1 from tmp); drop table tmp;
-----------------------------------------
我是一个招聘网站。 有很多招聘的用户名重复,但有的用户名重复,只是同一个用户名但又不是同一个职位。
能不能写一条语句,把用户名和职位都重复的列出来。
select a.* from job_list a, (select username,jobtitle from job_list group by username,jobtitle having count(1)>1) b where a.username =b.username and a.jobtitle=b.jobtitle
-----------------------------------------
alter table job_list add autoid int auto_increment not null;
create table tmp select min(autoid) as autoid from job_list group by username,jobtitle;
create table tmp2 select job_list.* from job_list,tmp where job_list.autoid = tmp.autoid;
drop table job_list;
rename table tmp2 to job_list;
----------------------------------------
create table tmp select min(id) as id from job_list group by username,jobtitle;
create table tmp2 select job_list.* from job_list,tmp where job_list.id = tmp.id;