I'm not sure exactly how I want to ask this question so I'll provide the data and the end results I'm looking for.
Q Number | M Number | Date | Type | Result
------------------------------------------------
Q-0005 | M-00099 | 2/2/15 | Pal | 1
Q-0005 | M-00099 | 2/2/15 | Pal | 2
Q-0007 | M-00095 | 2/2/15 | Pal | 1
Q-0007 | M-00095 | 2/1/15 | Pal | 3
Q-0005 | M-00099 | 2/1/15 | CompID | 25AD
Q-0007 | M-00095 | 2/2/15 | CompID | 15AD
Q-0005 | M-00099 | 2/1/15 | CompLO | ZYZ23
Q-0007 | M-00095 | 2/2/15 | CompLO | ZYZ23
This is how the data is stored within SQL Server.
However I would like to be able to sort by Type
and they're result. So, if I wanted to find the Q-Number
where Pal = 1 and CompID = 25AD and CompLO = ZYZ23
I can't seem to find a way to pivot the Type
column, if that's even possible.
Q Number | M Number | Date | PAL | CompID | CompLO
------------------------------------------------------
Q-0005 | M-00099 | 2/2/15 | 1 | 25AD | ZYZ23
Q-0005 | M-00099 | 2/2/15 | 2 | 25AD | ZYZ23
Q-0005 | M-00099 | 2/2/15 | 3 | 25AD | ZYZ23
Q-0007 | M-00095 | 2/1/15 | 3 | 15AD | ZYZ23
Any help would be appreciated.
-Kevin