HOME

FORUM

UPLOAD SOURCE

RPGLE/RPG

CLLE

SQLRPGLE

DDS

API

OTHER

JAVA

IFS

HTML

JAVA SCRIPT

PHP

MYSQL

XML

OLE DB




    MYSQL  - Select random record(s) from table
Posted By: JimmyOctane   Contact
$seed= rand(); 

$result=mysql_query("select * from quotes  ORDER BY RAND($seed) LIMIT 1");

$num=mysql_numrows($result);

This case only 1 value will be returned.
(LIMIT 1). To get more results change the limit amount.

    MYSQL  - Date functions MYSQL
Posted By: JimmyOctane   Contact
ADDDATE(date,INTERVAL expr type) 
ADDDATE(expr,days) 

When invoked with the INTERVAL form of the second argument,
ADDDATE() is a synonym for DATE_ADD(). The related function SUBDATE() is a synonym for DATE_SUB(). mysql> SELECT DATE_ADD('2004-01-02', INTERVAL 31 DAY); -> '2004-02-02' mysql> SELECT ADDDATE('2004-01-02', INTERVAL 31 DAY); -> '2004-02-02' As of MySQL 4.1.1, the second syntax is allowed, where expr is a date or
datetime expression and days is the number of days to be added to expr. mysql> SELECT ADDDATE('2004-01-02', 31); -> '2004-02-02' ADDTIME() was added in MySQL 4.1.1. CURDATE() Returns the current date as a value in 'YYYY-MM-DD' or YYYYMMDD
format, depending on whether the function is used in a string or
numeric context: mysql> SELECT CURDATE(); -> '2004-12-15' mysql> SELECT CURDATE() + 0; -> 20041215 CURRENT_DATE CURRENT_DATE() CURRENT_DATE and CURRENT_DATE() are synonyms for CURDATE(). CURTIME() Returns the current time as a value in 'HH:MM:SS' or HHMMSS format,
depending on whether the function is used in a string or numeric context: mysql> SELECT CURTIME(); -> '23:50:26' mysql> SELECT CURTIME() + 0; -> 235026 CURRENT_TIME CURRENT_TIME() CURRENT_TIME and CURRENT_TIME() are synonyms for CURTIME(). CURRENT_TIMESTAMP CURRENT_TIMESTAMP() CURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW(). DATE(expr) Extracts the date part of the date or datetime expression expr. mysql> SELECT DATE('2003-12-31 01:02:03'); -> '2003-12-31' DATE() is available as of MySQL 4.1.1. DATEDIFF(expr,expr2) DATEDIFF() returns the number of days between the start date expr and the end
date expr2. expr and expr2 are date or date-and-time expressions. Only the
date parts of the values are used in the calculation. mysql> SELECT DATEDIFF('2004-01-02 23:59:59','2004-01-01'); -> 1 mysql> SELECT DATEDIFF('2004-01-31 23:59:59','2004-01-31'); -> -30

    MYSQL  - codigo de as400
Posted By: juan   Contact

deseo q me den codigos de operaciones matematicas en as400

About Code400.com | resume | Search | Site Map | Suggestions
© Copyright 2003-2008 Code400.com



Monday Sep 06, 2010 @ 5:59 PM