求一SQL语句~
有一表结构如下:   
 id		name 
 -------------- 
 1211 
 1212 
 1213 
 1214 
 1215 
 1216 
 1217 
 1218     
 要求选出最后一位能被3除后余0的记录:   
 1213 
 1216
------解决方案--------------------select id from table whrere cast(right(id,1) as int)%3=0?
------解决方案--------------------select id from tb where (right(convert(char(4),id),1)%3)=0
------解决方案--------------------可以 
 select id from #temp where cast(right(id,1) as int)%3=0   
 ---- 
 1213 
 1216     
------解决方案--------------------create table T(id int) 
 insert T select 1211 
 union all select 1212 
 union all select 1213 
 union all select 1214 
 union all select 1215 
 union all select 1216 
 union all select 1217 
 union all select 1218   
 select * from T  
 where right(rtrim(id), 1)%3=0   
 --result 
 id           
 -----------  
 1213 
 1216   
 (2 row(s) affected)