-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPedigree.sql
More file actions
34 lines (31 loc) · 852 Bytes
/
Pedigree.sql
File metadata and controls
34 lines (31 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* Copyright (c) 2015-2018 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
SELECT
d.id as Id,
d.dam as Dam,
d.sire as Sire,
CASE (d.id.demographics.gender.code)
WHEN 'e' THEN 1
WHEN 'm' THEN 1
WHEN 'v' THEN 1
WHEN 'c' THEN 2
WHEN 'f' THEN 2
WHEN 's' THEN 2
ELSE 3
END AS gender,
d.id.demographics.gender.meaning as gender_code,
CASE (d.id.demographics.calculated_status)
WHEN 'Alive' THEN 0
ELSE 1
END
AS status,
d.id.demographics.calculated_status as status_code,
d.id.demographics.species.common as species,
'' as Display,
'Demographics' as source,
d.modified
FROM study.demographics d
WHERE d.Dam IS NOT NULL OR d.Sire IS NOT NULL