goransaler
IS-IT--Management
Hello
I have a question
if have tables like this
NEWS A table
ID NAME
1 NEWS1
2 NEWS2
NAME B table
ID NAME
1 JIM
2 ADAM
ISSUE C table
ID NAME
1 ISSUE1
2 ISSUE2
3 ISSUE3
4 ISSUE4
(if a new ISSUE row is added a row whith BID is set as <NULL> and always a AID)
ABC table
ID AID BID CID
1 1 <NULL> 1
2 1 <NULL> 2
3 1 <NULL> 1
4 1 <NULL> 2
5 1 1 1
6 1 1 2
7 1 2 1
If i like to view it like this
JIM
* ISSUE1
* ISSUE2
ISSUE3
ISSUE4
If i try with
SELECT dbo.ABC.ID, dbo.ABC.AID, dbo.ABC.BID, dbo.C.AAA, CASE WHEN dbo.ABC.BID IS NULL THEN ' ' ELSE '# ' END + SUBSTRING(dbo.C.AAA, 1, 20)
AS Activeact
FROM dbo.ABC INNER JOIN
dbo.C ON dbo.ABC.CID = dbo.C.ID
WHERE dbo.ABC.BID = 1 OR
dbo.ABC.BID IS NULL
I get this
ISSUE1
ISSUE2
ISSUE3
ISSUE4
* ISSUE1
* ISSUE2
I cant figure out how to do this please help
I have a question
if have tables like this
NEWS A table
ID NAME
1 NEWS1
2 NEWS2
NAME B table
ID NAME
1 JIM
2 ADAM
ISSUE C table
ID NAME
1 ISSUE1
2 ISSUE2
3 ISSUE3
4 ISSUE4
(if a new ISSUE row is added a row whith BID is set as <NULL> and always a AID)
ABC table
ID AID BID CID
1 1 <NULL> 1
2 1 <NULL> 2
3 1 <NULL> 1
4 1 <NULL> 2
5 1 1 1
6 1 1 2
7 1 2 1
If i like to view it like this
JIM
* ISSUE1
* ISSUE2
ISSUE3
ISSUE4
If i try with
SELECT dbo.ABC.ID, dbo.ABC.AID, dbo.ABC.BID, dbo.C.AAA, CASE WHEN dbo.ABC.BID IS NULL THEN ' ' ELSE '# ' END + SUBSTRING(dbo.C.AAA, 1, 20)
AS Activeact
FROM dbo.ABC INNER JOIN
dbo.C ON dbo.ABC.CID = dbo.C.ID
WHERE dbo.ABC.BID = 1 OR
dbo.ABC.BID IS NULL
I get this
ISSUE1
ISSUE2
ISSUE3
ISSUE4
* ISSUE1
* ISSUE2
I cant figure out how to do this please help