select count(*) as MyCount from (select * from sl_type where tid1='3' and cid1=9 order by id desc) MyTempTable