SQL Query Question

From: Doobie Keebler <basil_x_fawlty_at_hotmail.com>
Date: 28 Apr 2003 08:46:07 -0700
Message-ID: <ff9649db.0304280746.66b11d02_at_posting.google.com>


I'm hoping that some SQL gurus can help me with this one. I only have an intermediate SQL knowledge.

Let's say I have two tables like this:

Table1:
Name



Foo1
Foo2

Table2:
Name Depth Address
---- ----- -------

Foo1  0      Bar
Foo1  1      Baz
Foo2  0      Qux
Foo2  1      Quux
Foo2  2      Quuux

And I want to use an SQL query to end up with this result:

Name Add0 Add1 Add2
---- ---- ---- ----

Foo1 Bar Baz NULL
Foo2 Qux Quux Quuux

I have a method of doing this using a cursor, but I've read that cursors are not great for perf, and should be used only as a last resort. Is there a way of doing this without using a cursor?

Thanks! Received on Mon Apr 28 2003 - 17:46:07 CEST

Original text of this message