CREATE TABLE `songs` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`artist_name` varchar(255) DEFAULT NULL,
`song_title` varchar(255) DEFAULT NULL,
`label` varchar(255) DEFAULT NULL,
`notes` text,
`added` datetime DEFAULT NULL,
`hide` tinyint(4) DEFAULT NULL,
`type_mr` varchar(1) DEFAULT 'N',
`type_ind` varchar(1) DEFAULT 'N',
`type_ter` varchar(1) DEFAULT 'N',
`pos_mr` varchar(255) DEFAULT NULL,
`pos_ind` varchar(255) DEFAULT NULL,
`pos_bb` varchar(255) DEFAULT NULL,
`pos_ac` varchar(255) DEFAULT NULL,
`pos_aa` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=50 DEFAULT CHARSET=latin1;
CREATE TABLE `stations` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`call_sign` varchar(255) DEFAULT NULL,
`ind_call_sign` varchar(255) DEFAULT NULL,
`mr_call_sign` varchar(255) DEFAULT NULL,
`station_type` varchar(255) DEFAULT NULL,
`ind` varchar(255) DEFAULT NULL,
`mr` varchar(255) DEFAULT NULL,
`tert` varchar(255) DEFAULT NULL,
`act` varchar(255) DEFAULT NULL,
`contact` varchar(255) DEFAULT NULL,
`secondary_contact` varchar(255) DEFAULT NULL,
`shipping_address` varchar(255) DEFAULT NULL,
`shipping_city` varchar(255) DEFAULT NULL,
`shipping_state` varchar(255) DEFAULT NULL,
`shipping_zip` varchar(255) DEFAULT NULL,
`mailing_address` varchar(255) DEFAULT NULL,
`mailing_city` varchar(255) DEFAULT NULL,
`mailing_state` varchar(255) DEFAULT NULL,
`mailing_zip` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`secondary_email` varchar(255) DEFAULT NULL,
`phone` varchar(255) DEFAULT NULL,
`station_owner` varchar(255) DEFAULT NULL,
`rep` varchar(255) DEFAULT NULL,
`call_day` varchar(255) DEFAULT NULL,
`alt_call_day` varchar(255) DEFAULT NULL,
`old_alt_call_day` varchar(255) DEFAULT NULL,
`old_call_day` varchar(255) DEFAULT NULL,
`call_time_start` time DEFAULT NULL,
`call_time_end` varchar(255) DEFAULT NULL,
`soundscan_market` varchar(255) DEFAULT NULL,
`consultant` varchar(255) DEFAULT NULL,
`website` varchar(255) DEFAULT NULL,
`start_call` time DEFAULT NULL,
`notes_updated` timestamp NULL DEFAULT NULL,
`end_call` time DEFAULT NULL,
`notes` text,
`archive` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=297 DEFAULT CHARSET=latin1;
CREATE TABLE `tracking_entry` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`song_id` int(11) DEFAULT NULL,
`station_id` int(11) DEFAULT NULL,
`chart_week` int(11) DEFAULT NULL,
`mr_spins` int(11) DEFAULT NULL,
`mr_finalized` int(11) DEFAULT NULL,
`mr_position` int(11) DEFAULT NULL,
`ind_spins` int(11) DEFAULT NULL,
`ind_position` int(11) DEFAULT NULL,
`notes` text,
`notes_updated` datetime DEFAULT NULL,
`activity_log` text,
`chart_year` int(11) DEFAULT NULL,
`mr_spins_updated` datetime DEFAULT NULL,
`indflag` varchar(255) DEFAULT NULL,
`ind_spins_updated` datetime DEFAULT NULL,
`ind_td` int(11) DEFAULT NULL,
`last_week_mr_spins` int(11) DEFAULT NULL,
`last_week_ind_pos` int(11) DEFAULT NULL,
`last_week_ind_spins` int(11) DEFAULT NULL,
`last_week_mr_pos` int(11) DEFAULT NULL,
`week_string` int(11) DEFAULT NULL,
`add` varchar(255) DEFAULT NULL,
`poss` varchar(255) DEFAULT NULL,
`last_week_ter_spins` int(11) DEFAULT NULL,
`ter_spins` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=223817 DEFAULT CHARSET=latin1;
Every week a new record is fired up for every station + song combination (ie. 20 stations, 20 songs = 400 records for this week). We work on 400 records for the week and then Sunday night the next week rolls over and all new records are created. Problem is - users have the ability to fire up random records before the week rolls over. Because of this I can’t just assume that the record needs to be created - thus my original problem. Creating all of the new (blank) records EXCEPT for those already existing for (station X + song X + week X) which may have been manually generated by a user.