What SQL query will help me to concatenate two different tables with different numbers of rows? For example, I have one table with column1 and column2 and three rows, and second table with column3 and column4 and five rows. How can I make a third table with column1, column2, column3 and column4 and five rows in it (so that the last two rows, column1 and column2, are empty)?

    Requires Free Membership to View

The simple answer to this question is: you can't do this with SQL.

Copy and paste your data into Excel. Then find a way to import the Excel sheet into your new table. Relational databases are, fundamentally, about the relationships between data. Your data isn't related—or, if it is, you failed to describe how.

This was first published in November 2008

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: