我写了两个查询语句,都是对一张表操作的,SELECT usercode,status,time2 FROM loguser l where l.status='upload' group by usercode order by time2 desc ;SELECT usercode,status,time2 FROM loguser l where l.status='administrator upload artwork' group by usercode order by time2 desc ;我想查询出第一结果集的time2大于第二结果集time2的usercode记录,请问怎么查询,谢谢了

解决方案 »

  1.   

    select a.usercode
    from (
    SELECT usercode,status,time2 FROM loguser l where l.status='upload' group by usercode order by time2 desc
    ) a , (
    SELECT usercode,status,time2 FROM loguser l where l.status='administrator upload artwork' group by usercode order by time2 desc 
    ) b 
    where a.usercode=b.usercode and a.status=b.status and a.time2>b.time2