1.查询在线用户

SELECT
    GUID AS 序号,
    ACCOUNT AS 账户,
    NAME AS 角色名称,
    ELT(
        RACE,
        '人类',
        '兽人',
        '矮人',
        '暗夜精灵',
        '亡灵',
        '牛头人',
        '侏儒',
        '巨魔',
        '',
        '血精灵',
        '德莱尼'
    ) AS 种族,
ELT(class,'战士','圣骑士','猎人','盗贼','牧师','死亡骑士','萨满','法师','术士','','德鲁伊') AS 职业,
LEVEL AS 等级,
ceil(money/10000) AS 金币,
arenapoints AS 竞技场点数,
totalHonorPoints AS 荣誉点数,
IF(ONLINE = 1,'在线','离线') AS 在线状态,
CONCAT(floor(totaltime/86400),'天', floor(MOD(totaltime,86400)/3600),'小时') AS 游戏时间
FROM
    characters
WHERE online = 1

2.查询任务及其相关信息

SELECT
	qt.id AS 任务ID,
	qt.questtype AS 任务类别,
	qt.logtitle AS 任务名称,
	qt.logDescription AS 任务简报,
	qt.questDescription AS 任务内容,
	qt.objectivetext1 AS 文本1,
	qt.objectivetext2 AS 文本2,
	qt.objectivetext3 AS 文本3,
	qt.objectivetext4 AS 文本4,
	it. NAME AS 道具名称1,
	ct. NAME AS 生物名称1,
	ct2. NAME AS 生物名称2,
	ct3. NAME AS 生物名称3,
	gt. NAME AS 事件名称1,
	gt2. NAME AS 事件名称2,
	gt3. NAME AS 事件名称3,
	gt4. NAME AS 事件名称4
FROM
	quest_template qt
LEFT JOIN item_template it ON qt.RequiredItemId1 = it.entry
LEFT JOIN creature_template ct ON qt.RequiredNpcOrGo1 = ct.entry
LEFT JOIN creature_template ct2 ON qt.RequiredNpcOrGo2 = ct2.entry
LEFT JOIN creature_template ct3 ON qt.RequiredNpcOrGo3 = ct3.entry
LEFT JOIN gameobject_template gt ON gt.entry = ABS(qt.RequiredNpcOrGo1)
LEFT JOIN gameobject_template gt2 ON gt2.entry = ABS(qt.RequiredNpcOrGo2)
LEFT JOIN gameobject_template gt3 ON gt3.entry = ABS(qt.RequiredNpcOrGo3)
LEFT JOIN gameobject_template gt4 ON gt4.entry = ABS(qt.RequiredNpcOrGo4)