get evaluation sums by date.txt 1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
SELECT
	sheep_table.sheep_name
	, sheep_table.nsip_id
	, sheep_table.birth_date
	, sheep_evaluation_table.age_in_days
	, sheep_evaluation_table.id_evaluationid
	, sheep_evaluation_table.eval_date
	, (	
		sheep_table.birth_type
		+ sheep_table.codon171 
		+ sheep_evaluation_table.trait_score01 
		+ sheep_evaluation_table.trait_score02 
		+ sheep_evaluation_table.trait_score03 
		+ sheep_evaluation_table.trait_score04 
		+ sheep_evaluation_table.trait_score05 
		+ sheep_evaluation_table.trait_score06 
		+ sheep_evaluation_table.trait_score07 
		+ sheep_evaluation_table.trait_score08 
		+ sheep_evaluation_table.trait_score09 
		+ sheep_evaluation_table.trait_score10 
Oogie McGuire's avatar
Oogie McGuire committed
21
		+ (sheep_evaluation_table.trait_score12/10)
22
		) AS overall_score
Oogie McGuire's avatar
Oogie McGuire committed
23
	, sheep_evaluation_table.trait_score11 as weight
24 25 26
FROM  sheep_evaluation_table 
INNER JOIN sheep_table ON sheep_evaluation_table.sheep_id = sheep_table.sheep_id 
WHERE 
Oogie McGuire's avatar
Oogie McGuire committed
27
	eval_date LIKE "2018-11-09" 
28 29 30 31
ORDER BY 
	nsip_id
	, overall_score DESC
	, sheep_evaluation_table.id_evaluationid  ASC