List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 6 2002 5:52pm
Subject:Re: two table's columns into one columns w/o INSERT ... SELECT?
View as plain text  
If you have MySQL 4, you can use a UNION.
Otherwise you'll need a second table, because what you want is not
a join, but a concatenation of result sets.

At 12:47 -0500 5/6/02, Jay Blanchard wrote:
>Here is a puzzler for SQL jockies on a Monday afternoon. I have 2 tables,
>each with what may or may not be a unique range of dates;
>
>tblDate1
>+--------+------------+
>| field1 | rDate      |
>+--------+------------+
>|      1 | 2002-03-01 |
>|      2 | 2002-03-03 |
>|      3 | 2002-03-05 |
>|      4 | 2002-03-07 |
>+--------+------------+
>
>tblDate2
>+--------+------------+
>| field1 | rDate      |
>+--------+------------+
>|      1 | 2002-03-02 |
>|      2 | 2002-03-04 |
>|      3 | 2002-03-06 |
>|      4 | 2002-03-08 |
>|      5 | 2002-03-07 |
>+--------+------------+
>
>I need a SQL query that returns these as one column with no duplicates,
>preferably without having to create a temp table by doing an INSERT
>....SELECT
>+------------+
>| rDate      |
>+------------+
>| 2002-03-01 |
>| 2002-03-02 |
>| 2002-03-03 |
>| 2002-03-04 |
>| 2002-03-05 |
>| 2002-03-06 |
>| 2002-03-07 |
>| 2002-03-08 |
>+------------+
>
>Has anyone done this before?
>
>Jay

Thread
two table's columns into one columns w/o INSERT ... SELECT?Jay Blanchard6 May
  • Re: two table's columns into one columns w/o INSERT ... SELECT?Paul DuBois6 May
    • RE: two table's columns into one columns w/o INSERT ... SELECT?Jay Blanchard6 May
      • RE: two table's columns into one columns w/o INSERT ... SELECT?Keith C. Ivey6 May
        • RE: two table's columns into one columns w/o INSERT ... SELECT?Jay Blanchard6 May
          • RE: Merge tables, was [two table's columns into one columns w/o INSERT ... SELECT?]Jay Blanchard6 May
            • RE: Merge tables, was [two table's columns into one columns w/oINSERT ... SELECT?]Paul DuBois6 May
              • RE: Merge tables, was [two table's columns into one columns w/o INSERT ... SELECT?]Jay Blanchard6 May
                • RE: Merge tables, was [two table's columns into one columns w/oINSERT ... SELECT?]Paul DuBois6 May
  • Question & Observation!problem9 May