Created
November 20, 2010 16:35
-
-
Save haarts/707945 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `affiliate_new_contracts` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`plan_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`contract_length` int(11) DEFAULT NULL, | |
`phone_brand` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`phone_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`phone_price` float DEFAULT NULL, | |
`price` float DEFAULT NULL, | |
`average_price_per_month` float DEFAULT NULL, | |
`phone_price_guestimate` float DEFAULT NULL, | |
`shop_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`phone_id` int(11) DEFAULT NULL, | |
`shipping_cost` float DEFAULT NULL, | |
`connection_cost` float DEFAULT NULL, | |
`credible_shop` tinyint(1) DEFAULT '0', | |
`addon` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`addon_price` float DEFAULT NULL, | |
PRIMARY KEY (`id`), | |
KEY `index_affiliate_new_contracts_on_plan_name` (`plan_name`), | |
KEY `index_affiliate_new_contracts_on_average_price_per_month` (`average_price_per_month`), | |
KEY `index_affiliate_new_contracts_on_price` (`price`) | |
) | |
SELECT * FROM `affiliate_new_contracts` WHERE (phone_brand IN ('Apple','Blackberry','HTC','LG','Motorola','Nokia','Samsung','Sony Ericsson') AND contract_length IN ('12','24') AND (addon IS NULL OR addon IN('Telfort Sms 300','Surf & Mail'))) AND (`affiliate_new_contracts`.`plan_name` = 'Telfort 100' AND `affiliate_new_contracts`.`credible_shop` = 1) ORDER BY average_price_per_month; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment