CREATE OR REPLACE DEFINER=`vn`@`localhost`
	SQL SECURITY DEFINER
	VIEW `vn`.`newBornSales`
AS SELECT
    `s`.`amount` AS `amount`,
    `s`.`clientFk` AS `clientFk`,
    `c`.`departmentFk` AS `departmentFk`,
    `s`.`dated` AS `dated`,
    `cn`.`firstShipped` AS `firstShipped`
FROM
    ((`bs`.`clientNewBorn` `cn`
JOIN `bs`.`sale` `s` ON
    (`cn`.`firstShipped` + interval 1 year > `s`.`dated`
        and `s`.`clientFk` = `cn`.`clientFk`))
JOIN `vn`.`client` `c` ON
    (`c`.`id` = `s`.`clientFk`));
