Results 1 to 4 of 4

Thread: SQL Select using multiple tables

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    17

    Question

    Hi all...

    When I'm selecting from multiple tables and do a

    select * from table1, table2
    where table1.value1 = table2.value1

    I noticed that the output I get includes every field from both tables. I'm wondering if there's a way to output the fields from just one of the tables.

    Technically, I can just do it like

    select table1.value1 table1.value2... from table1,table2
    where table1.value1 = table2.value1

    but I'd rather not do it this way. Any and all help is greatly appreciated. Thanks.


  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb LEFT JOIN

    May be you can try to use the LEFT JOIN?

    Code:
    SELECT Table1.value1, Table1.value2 FROM Table1 LEFT JOIN Table2 ON Table1.value1 = Table2.value1 ORDER BY Tabel1.value1 ASC;

  3. #3
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    Use the same format for your select statement just use:

    Code:
    "SELECT table1.* ..."

  4. #4

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    17
    Hey Chris and Negative0,

    Thanks for the help. I really appreciate it.

Posting Permissions

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



Click Here to Expand Forum to Full Width