Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $sql = "SELECT ch.*,
- CONCAT('[', IF(chat.character_id IS NULL, '', GROUP_CONCAT(DISTINCT CONCAT_WS('','{\"id\":\"', ab.id, '\", \"name\":\"', ab.name, '\", \"level\":\"', chab.level, '\", \"desc\":\"', ab.description,'\", \"type\":\"', abt.name, '\"}'))), ']') as _abilities,
- CONCAT('[', IF(chat.character_id IS NULL, '', GROUP_CONCAT(DISTINCT CONCAT_WS('','{\"id\":\"', at.id, '\", \"name\":\"', at.name, '\", \"val\":\"', chat.val, '\", \"max_val\":\"', chat.max_val, '\", \"desc\":\"', at.description,'\"}'))), ']') as _attributes,
- GROUP_CONCAT(DISTINCT CONCAT_WS('','{\"id\":\"', gu.id, '\", \"name\":\"', gu.name, '\"}')) as _guild,
- GROUP_CONCAT(DISTINCT CONCAT_WS('','{\"id\":\"', ra.id, '\", \"name\":\"', ra.name, '\", \"gender\":\"', ra.gender, '\"}')) as _race,
- GROUP_CONCAT(DISTINCT CONCAT_WS('','{\"id\":\"', re.id, '\", \"name\":\"', re.name, '\"}')) as _region
- FROM sunlight_rpg_character ch
- LEFT JOIN sunlight_rpg_character_ability chab ON chab.character_id = ch.id
- LEFT JOIN sunlight_rpg_ability ab ON chab.ability_id = ab.id
- LEFT JOIN sunlight_rpg_ability_type abt ON ab.type = abt.id
- LEFT JOIN sunlight_rpg_character_attribute chat ON chat.character_id = ch.id
- LEFT JOIN sunlight_rpg_attribute at ON chat.attribute_id = at.id
- LEFT JOIN sunlight_rpg_guild gu ON ch.guild_id = gu.id
- LEFT JOIN sunlight_rpg_race ra ON ch.race_id = ra.id
- LEFT JOIN sunlight_rpg_region re ON ch.region_id = re.id
- WHERE " . $where . " GROUP BY ch.id";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement