We help IT Professionals succeed at work.
Get Started

Output grid-like table from many unlinked tables

284 Views
Last Modified: 2021-04-21
Hi, I've been searching and thinking of a way to do this all day yesterday and I'm about to give up and do it in C#.  But before I do I'd really like to know if anyone can think of a way to do this in SQL.  What I want to do is make a query that returns rows based on other tables.  That's not clear, let's say I've got the following tables:

tbl1
a b c
d e f
g h i

tbl2
1 2 3
4 5 6
7 8 9
0 1 2

What I want is to get something like this:

a b c 1 2 3
d e f 4 5 6
g h i 7 8 9
NULL NULL NULL 0 1 2

I don't want to use the CREATE TABLE by the way, I hate the idea of temp tables, they should never be used :)

Thanks for any input!

I use SQL Server 2000.
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2010
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE