//For example
SELECT users.name, pnts.points, FROM_UNIXTIME(pnts.time_stamp,'%Y %D %M %h:%i:%s') AS date, pnts.description, pnts.reference, pnts.operation, users.mail
FROM userpoints_txn pnts
LEFT JOIN users users ON users.uid = pnts.uid
WHERE 1
Original Query
$totalrows = 10;
$sql = "SELECT
posts.Tags as tags,
posts.OwnerUserId as postsid,
posts.Id as postid,
posts.Body as body,
posts.Title as title,
users.Id as userid,
users.DisplayName as usersname
FROM posts
JOIN users ON posts.OwnerUserId = users.Id
WHERE posts.Title != '' order by rand() asc limit " . $totalrows;
$r = mysql_query($sql) or die(mysql_error());
Modified Version
$totalrows = 10;
$sql = "SELECT
posts.Tags as tags,
posts.OwnerUserId as postsid,
posts.Id as postid,
posts.Body as body,
posts.Title as title,
users.Id as userid,
users.DisplayName as usersname
FROM posts
JOIN users ON posts.OwnerUserId = users.Id
JOIN (select posts.id from posts where posts.title != '' order by rand() asc limit " . $totalrows .") AS tmp_result
ON (posts.Id = tmp_result.Id)";
$r = mysql_query($sql) or die(mysql_error());
insert into sitestats_rollup(hitdatetime,hitid,hitcount) select date_format(hitDate, "%Y-%m-%d %h:00:00"), hitKey, count(*) from sitestats group by 1,2 on duplicate key update hitcount=hitcount+1;
mysql
SHOW DATABASES;
mysql -u root -p
SET PASSWORD FOR root@localhost=PASSWORD('#PasswordHere#');
FLUSH PRIVILEGES;
CREATE DATABASE #NAME#;
DROP DATABASE #NAME#;
<!-- Granting user privileges -->
GRANT ALL PRIVILEGES ON #databaseName#.*
TO 'username'@'localhost'
IDENTIFIED BY '#userpassword';
SHOW GRANTS FOR '#username#'@'localhost'
mysql -u #UserName# -p #databaseName#
SHOW TABLES;
Follow these steps:
http://codex.wordpress.org/Converting_Database_Character_Sets
(see "Performing the actual conversion on your live database" section)
Then install this plugin:
UTF8 Sanitize (http://wordpress.org/extend/plugins/wp-utf8-sanitize/)
(fixes UTF8 encoding in titles).