update management group.txt 641 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
--	Update the management of sheep based on age and sex

UPDATE
	sheep_table 
SET 
--	For our sheep the following are the locations and their IDs
--	id_managementgroupid		management_group
--	1	Ewe Lambs
--	2	Ram Lambs
--	3	Ewe Yearlings
--	4	Ram Yearlings
--	5	Ewes
--	6	Rams
--
--	Change the number below to correspond to the new management group for the sheep in the group

	management_group = 3
WHERE
--	Get only current alive sheep
	(sheep_table.remove_date IS NULL OR sheep_table.remove_date IS '') 
--	Edit this to be the proper sex 1 for rams, 2 for ewes and 3 for wethers
	AND sheep_table.sex=2 
	AND sheep_table.birth_date > "2017%"