Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Posts
    1

    Unanswered: select distinct from two tables

    I got two tables, table1 and table2:

    table1
    ---------
    country | code | something |
    ----------------------------
    England | eng | cookie
    USA | usa | banana
    Italy | ita | frog
    England | eng | green

    table2
    ---------
    country | code | somethang |
    -----------------------------
    Poland | pol | airplane
    Canada | can | boat
    England | eng | mule
    Brazil | bra | owl

    I'm trying to get it to return:

    Brazil | bra
    Canada | can
    England | eng
    Italy | ita
    Poland | pol
    USA | usa

    I can't get it to work, i've tried all i can think of, so i'd really appreciate if someone could help me on this.

    Thanks
    Last edited by nglvert; 06-13-04 at 11:19.

  2. #2
    Join Date
    Apr 2004
    Location
    Europe->Sweden->Stockholm
    Posts
    71
    Quote Originally Posted by nglvert
    I can't get it to work, i've tried all i can think of, so i'd really appreciate if someone could help me on this.
    Thanks
    I can't try this right now but shouldn't

    (SELECT country,code FROM table1)
    UNION DISTINCT
    (SELECT country,code FROM table2)

    work?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •