Reply to comment

INNER JOIN - normal table join

Syntax

    WHERE a.Field1 = b.Field2
    before SQL92 (implicit declaration of table joins)

    FROM Table1 [Alias1] INNER JOIN Table2 [Alias2] ON {Table1|Alias1}.TableKey = {Table2|Alias2}.TableKey
    SQL92 (explicit declaration of table joins)

Description

    The inner or equal join is the "normal" way for joining two tables: the records of two tables are joined, when the join expression build upon the fields from both tables evaluates as true.

    Example:

    -- before SQL 92
    SELECT a.vnum, a.vname, b.knum, b.kname
    FROM tverkauf a, tkunden b
    WHERE a.vnum = b.vnum
    ORDER BY vnum;
    
    -- SQL 92
    SELECT a.vnum, a.vname, b.knum, b.kname
    FROM tverkauf a INNER JOIN tkunden b ON a.vnum=b.vnum
    ORDER BY vnum;
    

    Result:

    vnum vname   knum kname
    1    Mueller 1    Lehmann
    1    Mueller 2    Schmidt
    1    Mueller 3    Schumacher
    2    Meyer   4    Schroeder
    2    Meyer   5    Stoiber
    3    Schulz  6    Lohmann
    3    Schulz  7    Krupp
    3    Schulz  8    Stradivari
    3    Schulz  9    Schumacher
    

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <p> <dd> <dl> <dt> <i> <li> <ol> <ul> <tt> <pre> <code> <img> <em> <blockquote> <strong>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.