特定的查询(在线等)
F_BH   字段值如下: 
 0101101 
 0102101 
 0103101 
 0101102 
 0102102    
 0103102 
 ... 
 现在要求以后三位为查询条件,例查出满足101都显示,可利用模糊查询时0101102也显示出来了,怎么办,请大家帮助?谢谢:)))
------解决方案--------------------Select * From TableName Where Right(F_BH, 3) =  '101 '
------解决方案--------------------Select * From TableName Where F_BH Like  '%101 '
------解决方案--------------------Create Table TEST 
 (F_BH	Varchar(10)) 
 Insert TEST Select  '0101101 ' 
 Union All Select  '0102101 ' 
 Union All Select  '0103101 ' 
 Union All Select  '0101102 ' 
 Union All Select  '0102102 '  
 Union All Select  '0103102 ' 
 GO 
 --方法一 
 Select * From TEST Where Right(F_BH, 3) =  '101 ' 
 --方法二 
 Select * From TEST Where F_BH Like  '%101 ' 
 GO 
 Drop Table TEST 
 --Result 
 /* 
 F_BH 
 0101101 
 0102101 
 0103101 
 */
------解决方案--------------------Select * From TableName Where Right(F_BH, 3) =  '101 ' 
 Select * From TableName Where Right(F_BH, 3) =  '102 ' 
 Select * From TableName Where Right(F_BH, 3) =  '103 '   
 前面的都可以不變,只是你的程序傳進去的參數變化而已。
------解决方案--------------------Select * From TableName Where Right(F_BH, 3) in(  '101 ', '102 ', '103 ')