The FROM clause specifies the tables from which a SELECT statement retrieves data.The syntax is as follows:
FROM table_reference [AS] [correlation_name] [, table_reference...]
Use a FROM clause to specify the table or tables from which a SELECT statement retrieves data. The value for a FROM clause is a comma-separated list of table names. Specified table names must follow SQL naming conventions for tables. The following SELECT statement below retrieves data from a single table:
SELECT *
FROM APCRED
You can alias tables. The following example uses table aliases to give each table a shorter name to be used in qualifying source fields in the query:
SELECT C.CustomerCode AS "Customer Code",
C.CustomerName AS "Customer Name",
H.DocumentNo AS "Invoice Number",
SUM(L.QuantitySupplied) "Total Qty"
FROM ARCUST C LEFT OUTER JOIN INHEAD H ON C.CUSTOMERCODE = H.CUSTOMERCODE
LEFT OUTER JOIN INLINE L ON H.DOCUMENTID = L.DOCUMENTID
WHERE C.CustomerName like '%Furn%'
GROUP BY C.CustomerCode, C.CustomerName, H.DocumentNo
ORDER BY C.CustomerCode
The table reference cannot be passed to a FROM clause via a parameter.
See JOIN clauses for information on retrieving data from multiple tables in a single SELECT query.