Next
/
Previous
/ Index
/ TCC Help System
/ Publications
/ Site map
/ NM Tech homepage
Sybase: computing values from search results
|
|
Okay, so you can search through a table and find the data you
need. Next, using some built in functions in Sybase, you can work
with the data. For instance, you can calculate how much a client
owes you for billable time.
At the end of each command press the space-bar or press enter
before continuing the the next step.
- To compute values on the results of a search, type
select
- Type the name of the columns you displayed after the search.
Separate each column name with a comma. Include the computation
command you want to do. Some of the commands you can use are:
- +: Addition
- -: Subtraction
- *: Multiplication
- /: Division
- %: Modulo
For example, to multiply the hours you have worked (column name
hours) by the charge per hour (column name wage)
you would type
select hours * wage
- Type
from
- Type the name of the table you are searching.
- Type
where
- Type the name of the column you are searching.
- Type
like
- Type
"
- Type the information you are looking for, including any
wildcards you may need (see
`Sybase searches when you know part of the data')
- Type
"
- Type
go
- Press Enter.
If there is a value that matches your search, you see the
results from your search and
(1 row affected)
The number may be 2 or 3, or whatever if your search matches more than
one row.
For example, to calculate how much your client Yoyodyne owes
you, and you have all the data in a table called
billable with a column named hours representing the time
you have worked for them, and a column called wages for the
charge per hour, type
select hours * wage from billable where
client=Yoyodyne go
Next: Searching multiple Sybase tables
See also: Searching Sybase databases
Previous: Sybase searches for multiple columns
Site map
Index:
Keyword index
to help pages
Help:
New Mexico Tech Computer Center: Help System
TCC Publications
Home:
About New Mexico Tech
Maintained by John Shipman, john@nmt.edu;
original by Steve Anderson
Last updated: 1997/06/25 00:27:22 UT
URL: http://www.nmt.edu/tcc/help/db/sybase/compute.html