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

mysql²éѯһÌ죬²éѯһÖÜ£¬²éѯһ¸öÔµÄÊý¾Ý

²éѯһÌ죺
select * from table where to_days(column_time) = to_days(now());
select * from table where date(column_time) = curdate();
²éѯһÖÜ£º
select * from table   where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(column_time);
²éѯһ¸öÔ£º
select * from table where DATE_SUB(CURDATE(), INTERVAL INTERVAL 1 MONTH) <= date(column_time);
mysqlµÄÈÕÆÚºÍʱ¼äº¯Êý
  
²éѯѡÔñËùÓÐ date_col ÖµÔÚ×îºó 30 ÌìÄڵļǼ¡£  
mysql> SELECT something from tbl_name
            WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;    //Õæ·½±ã,ÒÔÇ°¶¼ÊÇ×Ô¼ºÐ´µÄ,¾¹È»²»ÖªµÀÓÐÕâ,ʧ°Ü.
DAYOFWEEK(date)  
·µ»Ø date µÄÐÇÆÚË÷Òý(1 = Sunday, 2 = Monday, ... 7 = Saturday)¡£Ë÷ÒýÖµ·ûºÏ ODBC µÄ±ê×¼¡£  
mysql> SELECT DAYOFWEEK(’1998-02-03’);
         -> 3
WEEKDAY(date)  
·µ»Ø date µÄÐÇÆÚË÷Òý(0 = Monday, 1 = Tuesday, ... 6 = Sunday)£º  
mysql> SELECT WEEKDAY(’1998-02-03 22:23:00’);
         -> 1
mysql> SELECT WEEKDAY(’1997-11-05’);
         -> 2
DAYOFMONTH(date)  
·µ»Ø date ÊÇÒ»ÔÂÖеĵڼ¸Ì죬·¶Î§Îª 1 µ½ 31£º  
mysql> SELECT DAYOFMONTH(’1998-02-03’);
         -> 3
DAYOFYEAR(date)  
·µ»Ø date ÊÇÒ»ÄêÖеĵڼ¸Ì죬·¶Î§Îª 1 µ½ 366£º  
mysql> SELECT DAYOFYEAR(’1998-02-03’);
         -> 34
MONTH(date)  
·µ»Ø date ÖеÄÔ·ݣ¬·¶Î§Îª 1 µ½ 12£º  
mysql> SELECT MONTH(’1998-02-03’);
         -> 2
DAYNAME(date)  
·µ»Ø date µÄÐÇÆÚÃû£º  
mysql> SELECT DAYNAME("1998-02-05");
 &nbs


Ïà¹ØÎĵµ£º

ÈçºÎÌá¸ßMySQLÐÔÄÜ

Ò»¡¢ÎÊÌâµÄÌá³ö
¡¡¡¡ÔÚÓ¦ÓÃϵͳ¿ª·¢³õÆÚ£¬ÓÉÓÚ¿ª·¢Êý¾Ý¿âÊý¾Ý±È½ÏÉÙ£¬¶ÔÓÚ²éѯSQLÓï¾ä£¬¸´ÔÓÊÓͼµÄµÄ±àдµÈÌå»á²»³öSQLÓï¾ä¸÷ÖÖд·¨µÄÐÔÄÜ¡£ÓÅÁÓ£¬µ«ÊÇÈç¹û½«Ó¦ÓÃϵͳÌύʵ¼ÊÓ¦Óúó£¬Ëæ×ÅÊý¾Ý¿âÖÐÊý¾ÝµÄÔö¼Ó£¬ÏµÍ³µÄÏìÓ¦ËٶȾͳÉΪĿǰϵͳÐèÒª½â¾öµÄ×îÖ÷ÒªµÄÎÊÌâÖ®Ò»¡£ÏµÍ³ÓÅ»¯ÖÐÒ»¸öºÜÖØÒªµÄ·½Ãæ¾ÍÊÇSQLÓï¾äµÄÓÅ»¯¡£¶ÔÓ ......

¹ØÓÚmysql plugin ×Ô¶¨Òåϵͳ±äÁ¿

1. ¶¨Òå
/*
  Plugin system variables.
*/
static long     sysvar_one_value;
static char     *sysvar_two_value;
static MYSQL_SYSVAR_LONG(simple_sysvar_one, sysvar_one_value,
  PLUGIN_VAR_RQCMDARG,
  "Simple fulltext parser example system variab ......

MYSQL Íâ¼ü¶¨ÒåÓëʹÓÃ

 
ÔÚMySQL 3.23.44°æ±¾ºó£¬InnoDBÒýÇæÀàÐ͵ıíÖ§³ÖÁËÍâ¼üÔ¼Êø¡£
Íâ¼üµÄʹÓÃÌõ¼þ£º
1.Á½¸ö±í±ØÐëÊÇInnoDB±í£¬MyISAM±íÔÝʱ²»Ö§³ÖÍâ¼ü£¨¾Ý˵ÒÔºóµÄ°æ±¾ÓпÉÄÜÖ§³Ö£¬µ«ÖÁÉÙÄ¿Ç°²»Ö§³Ö£©£»
2.Íâ¼üÁбØÐ뽨Á¢ÁËË÷Òý£¬MySQL 4.1.2ÒÔºóµÄ°æ±¾ÔÚ½¨Á¢Íâ¼üʱ»á×Ô¶¯´´½¨Ë÷Òý£¬µ«Èç¹ûÔÚ½ÏÔçµÄ°æ±¾ÔòÐèÒªÏÔʾ½¨Á¢£»
3.Íâ¼ü¹ØÏ ......

MYSQL£ºCannot convert value '0000

½ñÌì´ÓMYSQLÊý¾Ý¿âץȡʱ£¬·¢ÉúÁËCannot convert value '0000-00-00 00:00:00' from column 10 to TIMESTAMPÒì³£
googleÁËһϣ¬´ó¸ÅÒâ˼ÊÇMySQLÖеÄDatetimeÖµÎÞ·¨ÔÙJAVAÖпɿ¿µÄ±»±íʾ£¬°´ÕÕJDBCºÍSQLµÄ±ê׼ĬÈÏÇé¿öϲúÉúÒì³£¡£
JDBCÔÊÐíÓÃÏÂÁеÄÖµ¶ÔzeroDateTimeBehavior ÊôÐÔÀ´ÉèÖÃÕâЩ´¦Àí·½Ê½£¬
exception (the d ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ