SELECT - SQL Command

Retrieves data from one or more tables. When you use SQL SELECT to create a query, Visual FoxPro parses the query and retrieves the specified data from the tables. You can create a SQL SELECT query from the Command window, in a Visual FoxPro program, or using the Query Designer. Please review the Considerations for SQL SELECT Statements help topic for more information on using SQL SELECT.

The full syntax for the SQL SELECT command appears as follows:

SELECT [ALL | DISTINCT] [TOP nExpr [PERCENT]] Select_List_Item [, ...]
   FROM [FORCE] Table_List_Item [, ...]
      [[JoinType] JOIN DatabaseName!]Table [[AS] Local_Alias]
      [ON JoinCondition [AND | OR [JoinCondition | FilterCondition] ...] 
   [WITH (BUFFERING = lExpr)]
   [WHERE JoinCondition | FilterCondition [AND | OR JoinCondition | FilterCondition] ...]
   [GROUP BY Column_List_Item [, ...]] [HAVING FilterCondition [AND | OR ...]]
   [UNION [ALL] SELECTCommand]
   [ORDER BY Order_Item [ASC | DESC] [, ...]]
   [INTO StorageDestination | TO DisplayDestination]
   [PREFERENCE PreferenceName] [NOCONSOLE] [PLAIN] [NOWAIT]

Expand imageRemarks

Expand imageExamples

Expand imageSee Also


© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic