paste(1) in SQL

Posted by pilcrow on Stack Overflow See other posts from Stack Overflow or by pilcrow
Published on 2010-04-20T14:55:26Z Indexed on 2010/04/20 15:03 UTC
Read the original article Hit count: 511

Filed under:
|
|

How in SQL could you "zip" together records in separate tables (à la the UNIX paste(1) utility)?

For example, assuming two tables, A and B, like so:

   A          B
========    ====
Harkness    unu
Costello    du
Sato        tri
Harper
Jones

How could you produce a single result set

   NAME  | NUM
===============
Harkness | unu
Costello | du
Sato     | tri
Harper   | NULL
Jones    | NULL

?

© Stack Overflow or respective owner

Related posts about sql

Related posts about record