   `maintable` varchar(150) NOT NULL,
   `refffield` varchar(150) NOT NULL,
   `reffquery` varchar(1000) NOT NULL,
-  `reffqueryedit` varchar(1000) NOT NULL
+  `reffqueryedit` varchar(1000) NOT NULL,
+  `jointable` varchar(250) NOT NULL,
+  `fieldjointable` varchar(200) NOT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
 --
 -- Dumping data for table `reff_table`
 --
 
-INSERT INTO `reff_table` (`maintable`, `refffield`, `reffquery`, `reffqueryedit`) VALUES
-('reff_users', 'groupid', 'select CONCAT(groupid,'' - '',description) as ''description'' FROM reff_groupid', 'select groupid,description FROM reff_groupid'),
-('reff_users', 'regionid', 'select CONCAT(regionid,'' - '',description) as ''description'' FROM reff_region', 'select regionid,description FROM reff_region');
+INSERT INTO `reff_table` (`maintable`, `refffield`, `reffquery`, `reffqueryedit`, `jointable`, `fieldjointable`) VALUES
+('reff_users', 'groupid', 'select CONCAT(groupid,'' - '',description) as ''description'' FROM reff_groupid', 'select groupid,description FROM reff_groupid', 'reff_groupid', 'description'),
+('reff_users', 'divisionid', 'select CONCAT(divisionid,'' - '',description) as ''description'' FROM reff_division', 'select divisionid,description FROM reff_division', 'reff_division', 'description');
 
 -- --------------------------------------------------------
 

  `regionid` int(11) NOT NULL AUTO_INCREMENT,
  `description` varchar(100) NOT NULL,
  PRIMARY KEY (`regionid`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `reff_region`

--

INSERT INTO `reff_tablekey` (`tablename`, `keyfields`, `fields`, `Condition`) VALUES
('reff_users', 'userid', 'userid,password,groupid,full_name,address,phone_number,email_address,divisionid,active', 'userid != ''admin''');

-- --------------------------------------------------------

