Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sql×Ö·û´®ÎÊÌâÇó½â

sqlÖÐÓÐÒ»±í
tableA
tour_id tour_type
1      1,2,3,4,5,6,16
2      11,23,35,46
3      9,5,3,77,89,12
ÏÖÔÚÈ¡³ötour_typeÖдæÔÚ3µÄ¼Ç¼
½á¹ûÓ¦¸ÃÊÇ 
1      1,2,3,4,5,6,16
3      9,5,3,77,89,12

SQL code:
select *
from tb
where charindex(',3,', ','+tour_type+',')>0


SQL code:
select * from tb where ','+tour_type +',' like '%,3,%'


SQL code:
--or
select * from tb where charindex(',3,', ','+tour_type+',')>0


SQL code:

delcare @var varchar(10)
set @var='3'
select * from tableA where charIndex(','+@var+',',','+tour_type+',')>0



SQL code:
select * from tableA
where charindex(',3,',','+tour_type+',')>0


SQL code



Code highlighting produced by Actipro CodeHighlighter (freeware)
htt


Ïà¹ØÎÊ´ð£º

¹ØÓÚSQLSERVERµ×²ãÎÊÌâ - MS-SQL Server / ÒÉÄÑÎÊÌâ

ÇëÎÊһϣ¬ÍâÍøÁ½Ì¨SQLSERVERʵÀýÊý¾Ý´«Ê䣬ÓÐûÓвÉÓÃÊý¾ÝѹËõºÍ¼ÓÃÜ¡£Ñ¹Ëõ±ÈÊǶàÉÙ£¬¼ÓÃÜÊÇʲô¼ÓÃÜËã·¨£¿Ïà¹ØÎĵµÄÄÀï¿ÉÒÔÕÒµ½£¿Ð»Ð»


ÎÒÒ²ÏëÖªµÀ£¡¹Ø×¢´ËÌù£¡

¹Ø×¢¡«¡«

Êý¾Ý¿â´óÅ£¶¼ÄÄÈ¥Á˰¡£¿
......

Çë½ÌsqlÓï¾ä¡£ - Oracle / ¿ª·¢

ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
  ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......

ÇóSQLÓï¾ä£¡£¡£¡ - MS-SQL Server / Ó¦ÓÃʵÀý

clientserial devseral chunnelnum devdata5
CZ0001 308001 5000 11.1
CZ0001 308001 5001 11.2
CZ0001 308001 5002 11.3
CZ0001 3080 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ