楼上
--------
select LOGIN_NAME,OP_TYPE,OP_TIME
from tb_operation_log
where OP_TYPE=0 and LOGIN_NAME not in(zhoudan,linjh,wangxj) and
LOGIN_NAME in (select LOGIN_NAME,max(convert(varchar(20),OP_TIME,120)) OP_TIME
from tb_operation_log
group by LOGIN_NAME)
order by OP_TIME desc
if exists(
select 1
from sysindexes a inner join sysindexkeys b on a.id = b.id
inner join syscolumns c on b.colid = c.colid
where object_name(a.id) = 'c' and c.name = 'cname')