Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions snprc_ehr/resources/queries/snprc_ehr/MhcDataPivot.sql
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
SELECT
b.Id,
b.modified,
b.Haplotype,
b.Ocid,
b.DataFileSource,
b.modified,
group_concat(b.MhcValue) as MhcValue


FROM (
SELECT
b.Id,
b.Haplotype,
b.Ocid,
b.MhcValue,
b.DataFileSource,
b.Modified
cast(b.modified as varchar) as modified
FROM snprc_ehr.MhcData as b
) as b

GROUP BY b.id, b.ocid, b.DataFileSource, b.haplotype, b.modified

PIVOT MhcValue BY Haplotype IN
(select distinct Haplotype from snprc_ehr.MhcData order by Haplotype
(select distinct ltrim(rtrim(Haplotype)) as Haplotype from snprc_ehr.MhcData order by Haplotype

)
2 changes: 1 addition & 1 deletion snprc_ehr/resources/source_queries/create_v_MchStatus.sql
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SELECT m.[Animal ID] AS id ,

FROM dbo.MhcStatus AS m -- select primates only from the TxBiomed colony
INNER JOIN labkey_etl.V_DEMOGRAPHICS AS d ON d.id = RIGHT(SPACE(6) + m.[Animal ID], 6)
WHERE [A001 Status] IS NOT NULL AND [B008 Status] IS NOT NULL AND [B017 Status] IS NOT NULL AND [B003 Status] IS NOT NULL
WHERE [A001 Status] IS NOT NULL OR [B008 Status] IS NOT NULL OR [B017 Status] IS NOT NULL AND [B003 Status] IS NOT NULL

GO

Expand Down