Support:Queries: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Kymara
imported>Hendrik Brummermann
 
(22 intermediate revisions by 2 users not shown)
Line 17: Line 17:
</source>
</source>


=== Merge character into an account ===
=== Merge all characters into an account ===

<source lang="SQL">
1. Learn the names of the original account and new account:
-- get ids as we will need them later

select id as account_id from account where username = '[account]';
<pre>
select id as character_account_id from account where username = '[character]';
SELECT account.username, account.status
update account set status = 'merged' where username ='[character]';
FROM characters, account
update characters set player_id = '[account_id]' where charname = '[character]';
WHERE account.id=player_id AND charname='[charname]';
insert into gameEvents (source, event, param1, param2)
</pre>
values ('[character]','accountmerge','[character_account_id]', '[character]-->[account]');

2. As user marauroa execute the following script. <nowiki>[oldaccount]</nowiki> is the account name, from which the characters are taken away.

<source lang="bash">
cd /var/www/stendhal/scripts/cmd
php merge.php [oldaccount] [newaccount]
</source>
</source>


Line 90: Line 96:
SELECT left(timedate, 10) As day, source, param1, count(*) As cnt
SELECT left(timedate, 10) As day, source, param1, count(*) As cnt
FROM gameEvents
FROM gameEvents
WHERE event='use' AND timedate>date_sub(CURDATE(), INTERVAL 3 day)
WHERE event='use' AND timedate>date_sub(CURDATE(), INTERVAL 30 day)
GROUP BY day, param1, source ORDER BY cnt DESC
GROUP BY day, param1, source ORDER BY cnt DESC
LIMIT 50;
LIMIT 50;