From

Specify the table(s) to be used in an SQL query.

Syntax
      SELECT column(s) FROM table1 INNER JOIN table2 
         ON table1.field1 compopr table2.field2

Key
   table1, table2   The tables from which records are combined.

   field1, field2   The fields to be joined.
                    The fields must be of the same data type and
                    contain the same kind of data, but they 
                    do not need to have the same name.

   compopr          Any relational comparison operator:
                     =  <  >  <=  >=  or  <>

The clauses (SELECT … FROM … WHERE … HAVING … ORDER BY … ) must be in this order.

SELECT Choose the columns to return.
FROM  The data table(s) to search. Selecting multiple tables may greatly increase the search space and slow down the query.
WHERE  Filter the data rows returned.
GROUP BY aggregate data.
HAVING  Filter out aggregated data that doesn’t meet a given criteria.
UNION  Merge the selected data into a result set.
ORDER BY  Sort the results.

Example

' In SQL
SELECT CategoryName, ProductName 
FROM Categories INNER JOIN Products
ON Categories.CategoryID = Products.CategoryID;

“Never was anything great achieved without danger” ~ Niccolo Machiavelli

Related:

DCount - Count the number of records in a table/query.
Avg (SQL) - Average
Max (SQL) - Return the maximum value from a query.
Min
(SQL) - Return the minimum value from a query.
Sum (SQL) - Add up the values in a query result set.


 
Copyright © 1999-2021 SS64.com
Some rights reserved