经典sql语句
2013-09-25 10:46
267 查看
select
a.title,a.username,b.adddate
from
table
a,(
select
max
(adddate) adddate
from
table
where
table
.title=a.title) b
这里select[code]max
(adddate) adddate
from
table
where
table
.title=a.title就相当于一个临时表把[/code]
delete from table1 where not exists ( select * from table2 where table1.field1=table2.field1 )[/code]有条件删除