Monday, July 23, 2018

Histogram - How to get pivot in SQL Query showing same ACN from 3 different archiveID

select distinct A.Field1 as ACN,

(select count(Field1) from ssfields where ArchiveID = '1' and Field1=A.Field1) as Row_Count_1,

(select count(Field1) from ssfields where ArchiveID = '5' and Field1=A.Field1) as Row_Count_5,

(select count(Field1) from ssfields where ArchiveID = '8' and Field1=A.Field1) as Row_Count_8

from ssfields A

No comments:

Post a Comment