Page 6-58
Programming
INTER-TEL
®
AXXESS
®
MANUAL VERSION 11.0 – May 2008
SQL Statements
10.31 You can use the equal (=) and less than (<) or greater than (>) commands to widen the
field of the search. For example, assume a database consisting of eight phones, all phones, with
the extension numbers 1001 through 1008. You could use the following commands to narrow
the list.
10.32 You can also use Boolean operators. For the next chart, assume the same database of
eight stations.
10.33 Notice how the last two expressions return the same result. You can use either the < and
> symbols or you can use the Boolean expression BETWEEN for the same things.
10.34 Also note that the third expression returned nothing even though it seems like it should
have returned 1005 and 1006. The reason it didn’t do this is because that expression requests a
list of phones that have the extension number 1005 and also have the extension number 1006.
To simplify, the AND expression applies to an individual device. To satisfy this, both numbers
would have to be assigned to the same station. This is not allowed by DB Programming. The
correct expression would be to use the operator “OR” which would request a list of phones
having the extension 1005 or the extension 1006.
10.35 Some of the fields do not require quotes around the values. These values are considered
to be numbers, not string expressions. String expressions, such as extension numbers and user
names must always be in quotes. Numeric expressions, such as node and port numbers, should
not be placed in quotes. This chart specifies the type of each field:
Table 6-8: SQL Command Examples (1)
SQL Statement Resulting List
[extension] < “1005” 1001, 1002, 1003, 1004
[extension] <= “1005” 1001, 1002, 1003, 1004, 1005
[extension] = “1005” 1005
[extension] > “1005” 1006, 1007, 1008
[extension] >= “1005” 1005, 1006, 1007, 1008
Table 6-9: SQL Command Examples (2)
SQL Statement Resulting List
[extension] = “1005” OR [extension] = “1006” 1005, 1006
[extension] = “1005” AND [extension] = “1006” Nothing found
[extension] NOT BETWEEN “1005” AND “1007” 1001, 1002, 1003, 1004, 1008
[extension] BETWEEN “1005” AND “1008” 1005, 1006, 1007, 1008
[extension] >= “1005” AND [extension] <= “1008” 1005, 1006, 1007, 1008
Table 6-10: SQL Field Quotes
Field Type Requires Quotes?
[circuit] Number No
[description] String Yes
[extension] String Yes
[node_number] Number No
[port] Number No
[slot_number] Number No
[username] String Yes