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

Ò»¸ö¸´ÔÓµÄmysql²éѯÓï¾ä(case,when,then,left join )

select `a`.`id` AS `id`,`a`.`UserName` AS `UserName`,
(case when (`a`.`sRegDate` = _utf8'1990-01-01 00:00:00.0') then _utf8'' else cast(date_format(`a`.`sRegDate`,_utf8'%Y-%m-%d %H:%i:%S') as char charset utf8) end) AS `sRegDate`,(case when (`a`.`feeendtime` = _utf8'1990-01-01 00:00:00.0') then _utf8'' else cast(date_format(`a`.`feeendtime`,_utf8'%Y-%m-%d %H:%i:%S') as char charset utf8) end) AS `feeendtime`,
(case when (`a`.`iStatus` = _utf8'0') then _utf8'Õý³£' when (`a`.`iStatus` = _utf8'1') then _utf8'Ëø¶¨' when (`a`.`iStatus` = _utf8'2') then _utf8'Ç··Ñ' when (`a`.`iStatus` = _utf8'') then _utf8'ÉêÇëÍ£»ú' else _utf8'' end) AS `iStatus`,
(case when (`a`.`PayType` = _utf8'0') then _utf8'Ãâ·Ñ' when (`a`.`PayType` = _utf8'2') then _utf8'СÇøÍøÓû§' when (`a`.`PayType` = _utf8'10') then _utf8'ÍⲿÓû§' else _utf8'' end) AS `PayType`,
`c`.`UserType` AS `sDh1`,`b`.`FeeName` AS `iFeeType`,
(case when (`a`.`PauseStartTime` = _utf8'1990-01-01 00:00:00.0') then _utf8'' else cast(date_format(`a`.`PauseStartTime`,_utf8'%Y-%m-%d %H:%i:%S') as char charset utf8) end) AS `PauseStartTime`,
(case when (`a`.`PauseStopTime` = _utf8'1990-01-01 00:00:00.0') then _utf8'' else cast(date_format(`a`.`PauseStopTime`,_utf8'%Y-%m-%d %H:%i:%S') as char charset utf8) end) AS `PauseStopTime`,
(case when (`a`.`AcctStartTime` = _utf8'1990-01-01 00:00:00.0') then _utf8'' else cast(date_format(`a`.`AcctStartTime`,_utf8'%Y-%m-%d %H:%i:%S') as char charset utf8) end) AS `AcctStartTime`,
(case when (`a`.`AcctStopTime` = _utf8'1990-01-01 00:00:00.0') then _utf8'' else cast(date_format(`a`.`AcctStopTime`,_utf8'%Y-%m-%d %H:%i:%S') as char charset utf8) end) AS `AcctStopTime`,
`a`.`speed` AS `speed`,
(case when (`a`.`idtype` = _utf8'7') then _utf8'Éí·ÝÖ¤' when (`a`.`idtype` = _utf8'1') then _utf8'½ÌÖ°¹¤' when (`a`.`idtype` = _utf8'2') then _utf8'±¾¿ÆÉú' when (`a`.`idtype` = _utf8'3') then _utf8'Ñо¿Éú' when (`a`.`idtype` = _utf8'4') then _utf8'ÀëÍËÉú' when (`a`.`idtype` = _utf8'5') then _utf8'


Ïà¹ØÎĵµ£º

mysql ʹÓÃrandËæ»ú²éѯ¼Ç¼ЧÂʲâÊÔ

Ò»Ö±ÒÔΪmysqlËæ»ú²éѯ¼¸ÌõÊý¾Ý£¬¾ÍÓÃ
SELECT
 
*
 
from
 `
table

ORDER
 
BY
 
RAND
() LIMIT 
5
¾Í¿ÉÒÔÁË¡£
µ«ÊÇÕæÕý²âÊÔһϲŷ¢ÏÖÕâÑùЧÂʷdz£µÍ¡£Ò»¸ö15ÍòÓàÌõµÄ¿â£¬²éѯ5ÌõÊý¾Ý£¬¾ÓȻҪ8ÃëÒÔÉÏ
²é¿´¹Ù·½ÊֲᣬҲ˵rand()·ÅÔÚORDER BY ×Ó¾äÖлᱻִÐж ......

JDBC ¼òµ¥µÄMysqlÁ¬½Ó

/*ÑÝʾһ¸öJDBC³ÌÐò£¬´ÓMysqlµÄLMDÊý¾Ý¿âÖжÁ³ö±íadminµÄÒ»¸öÐÅÏ¢*/
import java.sql.*;
public class TestMysqlConnection {
    public static void main(String[] args) {
        Connection conn = null;
        Statement stmt = ......

mysqlµ÷Óúó

ÓÃmysql_query£¬mysql_fetch_array()ºóÓ¦¸ÃÒª
free_result().function count_admin($where = '')
{
if($where) $where = " WHERE $where";
$result = $this->db->get_one("SELECT count(*) as num from $this->table_admin_role $where");
return $result['num'];
} ......

MySQLÊý¾Ý¿â±¸·ÝºÍ»¹Ô­µÄ³£ÓÃÃüÁת¡¿


MySQLÊý¾Ý¿â±¸·ÝºÍ»¹Ô­µÄ³£ÓÃÃüÁî
Ô­Îļûhttp://www.21andy.com/blog/20071102/655.html
ʱ¼ä£º2007-11-02 23:29:09   Àà±ð£º¼¼Êõ   ·ÃÎÊ£º3,731 views   RSS 2.0   ÆÀÂÛ  
±¸·ÝMySQLÊý¾Ý¿âµÄÃüÁî
mysqldump -hhostname -uusername -ppassword database ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ