Question

Asked on 2010-05-25 at 05:01:08ID: 26791848

Join two unrelated tables side-by-side

by: theskintman500

Rating8.9Very Good

I want to query two tables show the results side-by-side. I'm struggling to work it out for myself so hopefully someone here can help. It is important that the two sides can be ordered independently.

PEOPLE table:

NAME | AGE
----------
DAVE | 43
ANNE | 25
MIKE | 58

PLACES table:

COUNTRY | TOWN
----------------
USA     | WILMINGTON
GER     | BERLIN
POR     | LISBON
JPN     | KYOTO

Query something like:

select * from PEOPLE order by AGE asc
-join-
select * from PLACES order by TOWN asc

Result like:

NAME | AGE | COUNTRY | TOWN
-----------------------------
ANNE |  25 | GER     | BERLIN
DAVE |  43 | JPN     | KYOTO
MIKE |  58 | POR     | LISBON
           | USA     | WILMINGTON
                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:

Select allOpen in new window

  1. hi i am having a table of million records but i need …
    hi all, i am havng a tabl of many rows on it, but i need only 200 latest rows which is inserted in that tables. i dont have any ate stamp or seqid in that table. i am having a dobt with rowid? is we can use rowid for this? i am having a query which i will get latest record but i need latest 200 records in that table.... select * from emp where ro…
  2. Compair two tables
    I need to write a procedure which takes two parameters server1.tableA and server2.TableA. The structures of both tables are same but reside on different servers. I need to write a procedure which takes two parameters server1.tableA and server2.TableA. The structures of both tables are same but reside on different servers. I …
  3. Oracle SQL Inner Join Woes
    What the heck am I doing wrong here: SELECT obs1.PID, obs1.obsvalue FROM ML.OBS obs1 INNER JOIN select subobs.pid, max(subobs.obsdate) from ML.OBS subobs where subobs.hdid=21018 group by subobs.pid OBS2 ON OBS1.PID = OBS2.PID returns "invalid character"…
  4. problem with joining 2 tables
    Hi, I have two queries that shows cust no, cust name, and order number. The first query gets data from a table where stock related orders are generated and the second from a table where cost related orders are generated. In the code is the query with the output for both tables and I need to join them which is the last bit in the code. Appreciate any hel…
  5. Triggers not firing - troubleshooting
    On Oracle 11g Enterprise I have rather large compound triggers that I discovered were not firing this morning (and maybe never were, I'm setting up a new server and the trigger structure worked on the old one), so I created a simpler compound trigger to test: CREATE OR REPLACE TRIGGER "test" FOR INSERT OR DELET…

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
Troubleshooting
Tags
Participating Experts
5
Solution Grade
A

Replies

 by: cyberkiwi

Posted on 2010-05-25 at 05:05:47ID: 34783126

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: angelIII

Posted on 2010-05-25 at 05:08:03ID: 34783127

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: cyberkiwi

Posted on 2010-05-25 at 05:16:19ID: 34783128

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by:

Posted on 2010-05-25 at 07:10:20ID: 34783129

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: virdi_ds

Posted on 2010-05-25 at 07:43:07ID: 34783130

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: theskintman

Posted on 2010-05-25 at 08:12:17ID: 34783131

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: markgeer

Posted on 2010-05-25 at 08:32:55ID: 34783132

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: awking00

Posted on 2010-05-25 at 11:23:14ID: 34783133

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: theskintman

Posted on 2010-05-26 at 06:46:09ID: 34783134

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. sdstuber

    2,000

    0 points yesterday

    Profile

BrowseBecome an Expert