To use an expression in a query, you can type it directly into the Grid pane or you can enter it in the SQL pane as part of the statement. Entering expressions is similar to entering column names. For details about how to create an expression, see Creating an Expression.
Tip To make it easier to see long expressions on your screen, you can resize the columns in the Grid pane. For details, see Grid Pane.
In this topic you can read about:
You can display an expression in the result set by specifying the expression in place of a column in the Grid pane.
To display an expression in the result set
When you display an expression in the result set, the database assigns a column heading to it using the format "Exprn," where n is the number of the expression in the current query. To assign a more meaningful column heading, you can create an alias for the expression. For details, see Creating Column Aliases.
In some databases you can sort by the results of an expression. As with columns, you specify the sort type and sort order.
Note Not all databases allow you to sort using an expression. For details, refer to the documentation for your database.
To sort using an expression
There are two ways to use an expression for searching. The expression can be the condition against which you compare values, or it can function as the value you are comparing.
The following example illustrates how you can use an expression as the condition in a WHERE clause:
SELECT ord_num, ord_date
FROM sales
WHERE (price * .9) > 20
In contrast, the following example illustrates the opposite use of an expression, in which the expression is the value you are comparing:
SELECT ord_num, ord_date
FROM sales
WHERE (ord_date >= DATEADD(day, -10, GETDATE() ) )
The way you specify an expression for searching depends on whether it appears as a condition or as a value to search.
To use an expression as a condition
To use an expression as a search value