Code:
--
-- Table structure for table `inventaire`
--
CREATE TABLE IF NOT EXISTS `inventaire` (
`id` int(11) NOT NULL auto_increment,
`product_option_id` int(11) default NULL,
`entrepot` int(11) default NULL,
`limite` int(11) default NULL,
`qte_commande` int(11) default NULL,
`qte_deja_commande` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `inventaire_FI_1` (`product_option_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3224 ;
-- --------------------------------------------------------
--
-- Table structure for table `inventaire_boutique`
--
CREATE TABLE IF NOT EXISTS `inventaire_boutique` (
`id` int(11) NOT NULL auto_increment,
`boutique_id` int(11) default NULL,
`inventaire_id` int(11) default NULL,
`quantite` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `inventaire_boutique_FI_1` (`boutique_id`),
KEY `inventaire_boutique_FI_2` (`inventaire_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=6447 ;
-- --------------------------------------------------------
--
-- Table structure for table `product_option`
--
CREATE TABLE IF NOT EXISTS `product_option` (
`id` int(11) NOT NULL auto_increment,
`product_id` int(11) default NULL,
`tvq` tinyint(4) default NULL,
`name` varchar(64) collate utf8_unicode_ci NOT NULL,
`code` varchar(16) collate utf8_unicode_ci NOT NULL,
`description` text collate utf8_unicode_ci NOT NULL,
`price` decimal(5,2) default NULL,
`cout` decimal(5,2) default NULL,
`isbn` varchar(15) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`id`),
KEY `product_option_I_1` (`code`),
KEY `product_option_FI_1` (`product_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3224 ;
--
-- Table structure for table `inventaire`
--
CREATE TABLE IF NOT EXISTS `inventaire` (
`id` int(11) NOT NULL auto_increment,
`product_option_id` int(11) default NULL,
`entrepot` int(11) default NULL,
`limite` int(11) default NULL,
`qte_commande` int(11) default NULL,
`qte_deja_commande` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `inventaire_FI_1` (`product_option_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3224 ;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `inventaire`
--
ALTER TABLE `inventaire`
ADD CONSTRAINT `inventaire_FK_1` FOREIGN KEY (`product_option_id`) REFERENCES `product_option` (`id`);
--
-- Constraints for table `inventaire_boutique`
--
ALTER TABLE `inventaire_boutique`
ADD CONSTRAINT `inventaire_boutique_FK_1` FOREIGN KEY (`boutique_id`) REFERENCES `boutique` (`id`),
ADD CONSTRAINT `inventaire_boutique_FK_2` FOREIGN KEY (`inventaire_id`) REFERENCES `inventaire` (`id`);
--
-- Constraints for table `product_option`
--
ALTER TABLE `product_option`
ADD CONSTRAINT `product_option_FK_1` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`);
--
-- Constraints for table `inventaire`
--
ALTER TABLE `inventaire`
ADD CONSTRAINT `inventaire_FK_1` FOREIGN KEY (`product_option_id`) REFERENCES `product_option` (`id`);
Table A represents PRODUCT_OPTION,
Table B is BOUTIQUE
Table C is INVENTAIRE_BOUTIQUE
I have added another table (INVENTAIRE) which is linked to PRODUCT_OPTION
The tricky part I can't figure out is how to get a result from INVENTAIRE that would show the quantity for each BOUTIQUE on the same line.