Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Database/World Building

Development::Database/World Building World Building forum, dedicated to the EQEmu MySQL Database. Post partial/complete databases for spawns, items, etc.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 03-31-2018, 05:07 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

PURPOSE: List all Proving Grounds spawn group entries with a combined chance of less or greater than 100%,
NOTE: https://mariadb.com/kb/en/library/aggregate-functions/

Code:
SELECT                                  -- SELECT indicates these are the fields we want
  s2.zone AS zone_sn,                   -- zone shortname from spawn2 (aliased)
  s2.spawngroupID AS spawngroup_id,     -- spawngroupID field from spawn2 table (aliased)
  SUM(se.chance) AS spawn_chance        -- sum of all chance field from spawnentry table (aliased)
FROM                                    -- FROM lists tables to look for fields in
  spawn2 AS s2,                         -- s2 is now shorthand for spawn2 table
  spawnentry AS se,                     -- se is now shorthand for spawnentry table
  npc_types AS nt                       -- nt is now shorthand for npc_types table
WHERE                                   -- WHERE is how we filter results
  (                                     -- group similar conditions in parentheses
    zone LIKE "chambers%" OR            -- zone short name matches chambers* OR
    zone = 'provinggrounds'             -- zone short name is 'provinggrounds'
  ) AND                                 -- end of grouping
  se.spawngroupID = s2.spawngroupID AND -- match spawngroup_id in spawnentry and spawn2
  se.npcID = nt.id AND                  -- match npc_id in spawnentry and npc_types
  s2.enabled = 1                        -- spawn2 entry enabled
GROUP BY                                -- indicates we're looking at aggregate data
  spawngroup_id                         -- the field we're calculating via SUM in SELECT
HAVING                                  -- HAVING is used for filtering aggregate functions
  spawn_chance <> 100                   -- data filter (anything not 100%)
ORDER BY                                -- sort by these columns
  zone_sn,                              -- in order listed
  spawngroup_id;                        -- so it's easier to make sense of the data returned
Code:
+----------------+---------------+--------------+
| zone_sn        | spawngroup_id | spawn_chance |
+----------------+---------------+--------------+
| chambersa      |        259467 |          200 |
| chamberse      |        259477 |          200 |
| chambersf      |        259482 |          200 |
| provinggrounds |         43688 |          200 |
+----------------+---------------+--------------+
4 rows in set (0.01 sec)
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:39 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3