CREATE OR REPLACE DEFINER=`root`@`localhost`
	SQL SECURITY DEFINER
	VIEW `vn`.`newBornSales`
AS SELECT
    `s`.`amount` AS `amount`,
    `s`.`clientFk` AS `clientFk`,
    `c`.`salesDepartmentFk` AS `salesDepartmentFk`,
    `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`));