CREATE VIEW `sivir_products_input_list` AS
select distinct `product`.`relative` AS `relative`,
`product`.`users_sid` AS `users_sid`,
`product`.`global_branch_office_id` AS `global_branch_office_id`,
`product`.`product_kind` AS `product_kind`,
`product`.`fullname` AS `fullname`,
`product`.`description` AS `description`,
`product`.`code` AS `code`,
`product`.`category_id` AS `category_id`,
`product`.`subcategory_id` AS `subcategory_id`,
`product`.`brand_id` AS `brand_id`,
`product`.`images` AS `images`,
`product`.`barcode` AS `barcode`,
`product`.`enabled` AS `enabled`,
`product`.`status` AS `status`,
`product`.`created_at` AS `created_at`,
`product`.`updated_at` AS `updated_at`,
`price`.`price` AS `price`,
`price`.`currency_id` AS `currency_id`,
`currency`.`code` AS `currency`,
`farmovnq_core_test`.`category`.`label` AS `category`,
`stock`.`quantity` AS `quantity`,
`stock`.`measurement_id` AS `measurement_id`,
`farmovnq_core_test`.`measurement`.`label` AS `measurement`
from (((((`farmovnq_core_test`.`sivir_products` `product` join `farmovnq_core_test`.`sivir_products_price` `price`)
join `farmovnq_core`.`global_currency` `currency`)
join `farmovnq_core_test`.`sivir_catalog_category` `category`)
join `farmovnq_core_test`.`sivir_products_stock` `stock`)
join `farmovnq_core_test`.`sivir_catalog_measurement` `measurement`)
where ((`product`.`product_kind` = 'IAF')
and (`product`.`relative` = `price`.`product_id`)
and (`product`.`relative` = `stock`.`product_id`)
and (`price`.`currency_id` = `currency`.`codigoClasificador`)
and (`product`.`category_id` = `farmovnq_core_test`.`category`.`value`)
and (`product`.`global_branch_office_id` = `farmovnq_core_test`.`category`.`global_branch_office_id`)
and (`stock`.`measurement_id` = `farmovnq_core_test`.`measurement`.`value`)
and (`product`.`global_branch_office_id` = `farmovnq_core_test`.`measurement`.`global_branch_office_id`))
