I would like to get what I have shown in the desired results from the sample tables provided.
I have been struggling with creating the SQL to handle this:
CREATE TABLE a (account nvarchar(10), accountname nvarchar(10));
CREATE TABLE b (bid int, bdesc nvarchar(10));
CREATE TABLE C (cid int, bid int, caccount nvarchar(10));
INSERT INTO a VALUES ('a1','a1val');
INSERT INTO a VALUES ('b1','b1val');
INSERT INTO a VALUES ('c1','c1val');
INSERT INTO a VALUES ('d1','d1val');
INSERT INTO b VALUES (1,'val1');
INSERT INTO b VALUES (2,'val2');
INSERT INTO b VALUES (3,'val3');
INSERT INTO c VALUES (1,1,'a1');
INSERT INTO c VALUES (2,1,'b1');
INSERT INTO c VALUES (3,2,'a1');
INSERT INTO c VALUES (4,3,'c1');
--Desired results
--accountname val1 val2 val3
--a1val x x
--b1val x
--c1val x
--d1val
select * from a
select * from b
select * from c
drop table a, b, c