Hello, trying to write a query for the normal reading of the database fields. Here is the problem. Is the main table. Connected to it by id still have a lot of tables, and each of them, id from the main table can appear more than once. For each REP id in the external table returns a single record. For a small number of filters I managed to write a class in php, which results in the return result in order, but had to expand, and for the greater number - this is not the case.
Here is the query:'SELECT * FROM `companys`
INNER JOIN `countrys` ON `company`.`company_id` = `countrys`.`company_id`
INNER JOIN `country_value` ON `country_value`.`value_id` = `countrys`.`value_id`
INNER JOIN `prices` ON `company`.`company_id` = `prices`.`company_id`
INNER JOIN `service_description` ON `service_description`.`description_id` = `prices`.`description_id` '
Get the results:array(14) { ["company_id"]=> string(2) "66" ["name"]=> string(5) "iPage" ["href"]=> string(0) "" ["image"]=> string(54) "http://pickuphost.ru/wp-content/uploads/ipage-logo.jpg" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "124" ["value_id"]=> string(1) "1" ["price_id"]=> string(4) "1362" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1627" ["service_name"]=> string(7) "VDS_min" }
array(14) { ["company_id"]=> string(2) "66" ["name"]=> string(5) "iPage" ["href"]=> string(0) "" ["image"]=> string(54) "http://pickuphost.ru/wp-content/uploads/ipage-logo.jpg" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "232" ["value_id"]=> string(1) "2" ["price_id"]=> string(4) "1362" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1627" ["service_name"]=> string(7) "VDS_min" }
array(14) { ["company_id"]=> string(2) "66" ["name"]=> string(5) "iPage" ["href"]=> string(0) "" ["image"]=> string(54) "http://pickuphost.ru/wp-content/uploads/ipage-logo.jpg" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "463" ["value_id"]=> string(1) "6" ["price_id"]=> string(4) "1362" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1627" ["service_name"]=> string(7) "VDS_min" }
array(14) { ["company_id"]=> string(2) "66" ["name"]=> string(5) "iPage" ["href"]=> string(0) "" ["image"]=> string(54) "http://pickuphost.ru/wp-content/uploads/ipage-logo.jpg" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "490" ["value_id"]=> string(1) "7" ["price_id"]=> string(4) "1362" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1627" ["service_name"]=> string(7) "VDS_min" }
array(14) { ["company_id"]=> string(2) "66" ["name"]=> string(5) "iPage" ["href"]=> string(0) "" ["image"]=> string(54) "http://pickuphost.ru/wp-content/uploads/ipage-logo.jpg" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "550" ["value_id"]=> string(2) "10" ["price_id"]=> string(4) "1362" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1627" ["service_name"]=> string(7) "VDS_min" }
array(14) { ["company_id"]=> string(2) "66" ["name"]=> string(5) "iPage" ["href"]=> string(0) "" ["image"]=> string(54) "http://pickuphost.ru/wp-content/uploads/ipage-logo.jpg" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "570" ["value_id"]=> string(2) "11" ["price_id"]=> string(4) "1362" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1627" ["service_name"]=> string(7) "VDS_min" }
array(14) { ["company_id"]=> string(2) "67" ["name"]=> string(16) "Inmotion Hosting" ["href"]=> string(0) "" ["image"]=> string(65) "http://pickuphost.ru/wp-content/uploads/inmotion-hosting-logo.png" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "125" ["value_id"]=> string(1) "1" ["price_id"]=> string(4) "1363" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1952" ["service_name"]=> string(7) "VDS_min" }
nothing has changed, here goes the results:
array(14) { ["company_id"]=> string(2) "66" ["name"]=> string(5) "iPage" ["href"]=> string(0) "" ["image"]=> string(54) "pickuphost.ru/wp-content/uploads/ipage-logo.jpg" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "124" ["value_id"]=> string(1) "1" ["price_id"]=> string(4) "1362" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1627" ["service_name"]=> string(7) "VDS_min" }
array(14) { ["company_id"]=> string(2) "66" ["name"]=> string(5) "iPage" ["href"]=> string(0) "" ["image"]=> string(54) "pickuphost.ru/wp-content/uploads/ipage-logo.jpg" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "232" ["value_id"]=> string(1) "2" ["price_id"]=> string(4) "1362" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1627" ["service_name"]=> string(7) "VDS_min" }
array(14) { ["company_id"]=> string(2) "66" ["name"]=> string(5) "iPage" ["href"]=> string(0) "" ["image"]=> string(54) "pickuphost.ru/wp-content/uploads/ipage-logo.jpg" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "463" ["value_id"]=> string(1) "6" ["price_id"]=> string(4) "1362" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1627" ["service_name"]=> string(7) "VDS_min" }
array(14) { ["company_id"]=> string(2) "66" ["name"]=> string(5) "iPage" ["href"]=> string(0) "" ["image"]=> string(54) "pickuphost.ru/wp-content/uploads/ipage-logo.jpg" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "490" ["value_id"]=> string(1) "7" ["price_id"]=> string(4) "1362" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1627" ["service_name"]=> string(7) "VDS_min" }
array(14) { ["company_id"]=> string(2) "66" ["name"]=> string(5) "iPage" ["href"]=> string(0) "" ["image"]=> string(54) "pickuphost.ru/wp-content/uploads/ipage-logo.jpg" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "550" ["value_id"]=> string(2) "10" ["price_id"]=> string(4) "1362" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1627" ["service_name"]=> string(7) "VDS_min" }
array(14) { ["company_id"]=> string(2) "66" ["name"]=> string(5) "iPage" ["href"]=> string(0) "" ["image"]=> string(54) "pickuphost.ru/wp-content/uploads/ipage-logo.jpg" ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "570" ["value_id"]=> string(2) "11" ["price_id"]=> string(4) "1362" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1627" ["service_name"]=> string(7) "VDS_min" }
array(14) { ["company_id"]=> string(2) "67" ["name"]=> string(16) "Inmotion Hosting" ["href"]=> string(0) "" ["image"]=> string(65) "pickuphost.ru/wp-content/uploads/inmotion-hosting-..." ["VIP"]=> string(1) "0" ["free_period"]=> string(0) "" ["security"]=> string(0) "" ["VIP_value"]=> string(1) "0" ["country_id"]=> string(3) "125" ["value_id"]=> string(1) "1" ["price_id"]=> string(4) "1363" ["description_id"]=> string(1) "1" ["price"]=> string(4) "1952" ["service_name"]=> string(7) "VDS_min" }
etc. - sister commented on July 8th 19 at 11:44