SELECT
DISTINCT Remissierdetail.Scode AS oowncode
FROM Remissierdetail Remissierdetail
WHERE Remissierdetail.firmnumber = 'KSH-000001'
AND Remissierdetail.Scode ! = Rpad(' ',10)
UNION
SELECT
DISTINCT Remissierdetail.Scode1 AS oowncode
FROM Remissierdetail Remissierdetail
WHERE Remissierdetail.firmnumber = 'KSH-000001'
AND Remissierdetail.Scode1 ! = Rpad(' ',10)
UNION
SELECT
DISTINCT Remissierdetail.Scode2 AS oowncode
FROM Remissierdetail remissierdetail
WHERE Remissierdetail.Firmnumber = 'KSH-000001'
AND Remissierdetail.Scode2 ! = Rpad(' ',10)
UNION
SELECT
DISTINCT Remissierdetail.Scode3 AS oowncode
FROM Remissierdetail Remissierdetail
WHERE remissierdetail.Firmnumber = 'KSH-000001'
AND remissierdetail.Scode3 ! = Rpad(' ',10)
select /* kshitij */ distinct coowncode
from Remissierdetail
unpivot
(
coowncode
for node in (Scode,
Scode1,
Scode2,
Scode3)
) where Firmnumber = 'KSH-000001' and coowncode != Rpad(' ',10);
No comments:
Post a Comment