Home » SQL & PL/SQL » SQL & PL/SQL » select fields in a join
select fields in a join [message #252938] Fri, 20 July 2007 15:40 Go to next message
wmdaniels
Messages: 2
Registered: July 2007
Location: CT
Junior Member
I'm not sure how to search for this, looking up JOIN and SELECT haven't helped.

When joining two tables, I need to display (select) all columns from one table, but only 1 or 2 from another. Is there a quick way to do this (or do I have to write out every column)?

Thanks!
Re: select fields in a join [message #252941 is a reply to message #252938] Fri, 20 July 2007 16:02 Go to previous messageGo to next message
SnippetyJoe
Messages: 63
Registered: March 2007
Location: Toronto, Canada
Member
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 20 17:01:19 2007

select a.*, b.ename
from scott.dept a, scott.emp b
where a.deptno = b.deptno ;

    DEPTNO DNAME          LOC           ENAME
---------- -------------- ------------- ----------
        20 RESEARCH       DALLAS        SMITH
        30 SALES          CHICAGO       ALLEN
        30 SALES          CHICAGO       WARD
        20 RESEARCH       DALLAS        JONES
        30 SALES          CHICAGO       MARTIN
        30 SALES          CHICAGO       BLAKE
        10 ACCOUNTING     NEW YORK      CLARK
        20 RESEARCH       DALLAS        SCOTT
        10 ACCOUNTING     NEW YORK      KING
        30 SALES          CHICAGO       TURNER
        20 RESEARCH       DALLAS        ADAMS
        30 SALES          CHICAGO       JAMES
        20 RESEARCH       DALLAS        FORD
        10 ACCOUNTING     NEW YORK      MILLER



--
Joe Fuda
SQL Snippets
Re: select fields in a join [message #253309 is a reply to message #252941] Mon, 23 July 2007 07:59 Go to previous messageGo to next message
wmdaniels
Messages: 2
Registered: July 2007
Location: CT
Junior Member
Just wanted to say THANKS Joe!
Re: select fields in a join [message #253413 is a reply to message #253309] Mon, 23 July 2007 15:46 Go to previous message
SnippetyJoe
Messages: 63
Registered: March 2007
Location: Toronto, Canada
Member
You're welcome.
Previous Topic: I want function for FTP file to other server.
Next Topic: Table Partition
Goto Forum:
  


Current Time: Sun Dec 04 04:33:25 CST 2016

Total time taken to generate the page: 0.14255 seconds