mysqlÖÐINSTRº¯ÊýµÄÓ÷¨
mysqlÖÐINSTRº¯ÊýµÄÓ÷¨
INSTR(×Ö¶ÎÃû, ×Ö·û´®)
Õâ¸öº¯Êý·µ»Ø×Ö·û´®ÔÚijһ¸ö×ֶεÄÄÚÈÝÖеÄλÖÃ, ûÓÐÕÒµ½×Ö·û´®·µ»Ø0£¬·ñÔò·µ»ØλÖ㨴Ó1¿ªÊ¼£©
SELECT * from tblTopic ORDER BY INSTR( topicTitle, 'ha' ) > 0 DESC
SELECT INSTR( topicTitle, 'ha' ) from tblTopic
mysqlÖÐʹÓÃinstrÅäºÏINÅÅÐò
½«instr½á¹û×÷ΪһÁУ¬°´ÆäÅÅÐò
select id,1 from world_guide where id = 32
union
select * from
(select id, instr('30,35,31,',id+',') as d from
world_blog where id in (30,35,31) order by d) as t;
Êä³ö
+----+---+
| id | 1 |
+----+---+
| 32 | 1 |
| 30 | 1 |
| 35 | 4 |
| 31 | 7 |
+----+---+
4 rows in set, 6 warnings (0.02 sec)
±íA
×Ö¶Î:ÐÕÃû name
ÕÅÈý
ÍõÎå
±íB
×Ö¶Î:±êÌâ title
ÐÅÏ¢Ò» ÕÅÈý·¢²¼
ÐÅÏ¢¶þ ÍõÎå·¢²¼
ÐÅÏ¢Èý ÕÅÈý·¢²¼
ÅÅÐаñ£¬°´±íAµÄÐÕÃû like %‘name’% Æ¥Åä ±íBµÄ title µÄÌõÊý½øÐÐÅÅÐò,
ÅÅÐаñÑùÀý
ÕÅÈý 2
ÍõÎå 1
select ÐÕÃû,count(b.title) from a inner join b on instr(b.title,a.ÐÕÃû)>0
group by ÐÕÃû
order by count(b.title)
select name,(select count(*) from ±íB where instr(title,±íA.name)
from ±íA
order by 2 desc
Ïà¹ØÎĵµ£º
ÎҵĻ·¾³£º
ÔÓÐÒ»mysql5.0ʵÀý£¬ÏÖа²×°Ò»mysql5.1£¬²¢½«ÐµÄ5.1ʵÀýµÄÊý¾Ý·¾¶·ÅÔÚÁíһĿ¼¡£
mysql5.1µÄmy.iniÈçÏÂ
£¨ÅäÖÃmy.iniµÄ²Î¿¼×ÊÁÏ£º
http://dev.mysql.com/doc/refman/5.1/en/option-files.html
http://downloads.mysql.com/docs/mysql-windows-excerpt-5.1-en.pdf
http://dev.mysql.com/doc/refman/5.0 ......
1.DATE_FORMAT('2010-05-15 15:47:36','%H:%i:%s') -> ½á¹û£º15:47:36
½«ÈÕÆÚ¸ñʽ¸ù¾ÝÌõ¼þ²»Í¬×ª»»³ÉËùÐèÒªµÄÈÕÆÚ¡¢Ê±¼ä¸ñʽ
2.timediff('23:40:00', ' 18:30:00') -> ½á¹û£º05:10:00
......
Ò».°²×°
rpm·½Ê½
rpm -ivf MySQL*
tar·½Ê½
tar xzvf mysql-x.xx.tar.gz
cd mysqlp-x.xx Éú³Émakefile
./congigure
make ±àÒë
make install
mysql_install_db
¶þ.Æô¶¯¡¢¹Ø±Õ
ser ......
1.½¨±í¹ý³ÌÈçÏÂ
create database test default character set utf8 collate utf8_general_ci
use test;
create table devicedata
(
ID int auto_increment PRIMARY key ,
TimeStamp datetime,
Device_Name varchar(100),
Tag_Name varchar(100),
Value varchar(50)
)
2 ......
×÷/ÒëÕߣºÒ¶½ðÈÙ£¨Email: £©£¬À´Ô´£ºhttp://imysql.cn£¬×ªÔØÇë×¢Ã÷×÷/ÒëÕߺͳö´¦£¬²¢ÇÒ²»ÄÜÓÃÓÚÉÌÒµÓÃ;£¬Î¥Õ߱ؾ¿¡£
Ê×ÏÈ,ÕâƬÎÄÕ´¿´âÊÇÎҵĸöÈ˾Ñé̸֮,ÊÊÓÃÓÚÎÒ³£¼ûµÄ»·¾³¼°ÏîÄ¿ÖÐ.
¸öÈ˽¨Òé,Êý¾Ý¿â×Ö·û¼¯¾¡Á¿Ê¹ÓÃutf8(HTMLÒ³Ãæ¶ÔÓ¦µÄÊÇutf-8),ÒÔʹÄãµÄÊý¾ÝÄܺÜ˳ÀûµÄʵÏÖǨÒÆ,ÒòΪutf8×Ö·û¼¯ÊÇÄ¿Ç°×îÊʺÏÓÚÊ ......