     else
       delete sql.major
     
-    for minor_name, minor of minors
+    for minor in minors
       
       for minor_value in minor.values
+        if minor.sql
+          sql.minor = minor.sql.replace "?", minor_value
+        else
+          delete sql.major
         
         for script in scripts
           script_filename = "#{__dirname}/individual/#{script}"

fs      = require "fs"
mkdirp  = require "mkdirp"

majors =
  all: 
    values: ["all"]
  year: 
    sql: "YEAR(t.matchdate) = ?"
    values: [2004,2007,2008,2009,2010,2011,2012]
  player: 
    sql: "GET_PLAYER_NAME(p.playerid,'','') = '?'"
    values: ["Dan", "Tom", "JD", "Jeran", "Guest", "Spirk"]    
  location: 
    sql: "GET_LOCATION_NAME(t.location, 'ADDY') = '?'"
    values: [
      "1217 (Pomona, CA)"

outfile_path_root = "#{__dirname}/../parts/tables/"
list_item_limit = 10

for major in majors
  sql = {}
  for major_value in major.values
    if major.sql
