Next / Previous / Index / ITC Help System / Publications / Site map / NM Tech homepage

Sybase: computing values from search results

Tech Computer Center logo

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.

  1. To compute values on the results of a search, type
        select
  2. 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: 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
  3. Type
            from
  4. Type the name of the table you are searching.
  5. Type
            where
  6. Type the name of the column you are searching.
  7. Type
            like
  8. Type
            "
  9. Type the information you are looking for, including any wildcards you may need (see `Sybase searches when you know part of the data')
  10. Type
            "
  11. Type
            go
  12. 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 Information Technology and Communications: Help System
ITC Publications
To report a problem: File a ticket
Send mail to the User consultant on duty or call them at 575-835-5437
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
QR two-dimensional bar code