how to sum the value of all the record in a table?

how to sum the value of all the record in a table?

Dear all,

HI! How are you? I would like to know how can I write a script that calculate the sum of a value of all records in a table.

An example would be that I have a registration form which allow guest to register # of guest he/she will bring.

what I would like to know is how to write a script that calculate the total number of guest of all the registration record

Assuming that my table has the following 3 records
# Reg 001 guest 0
# Reg 002 guest 5
# Reg 003 guest 2

What I want to do is to calculate the total number of guest which is 7 guests!

Assuming that the following:
table name: registration
Field name: guest_num

would anyone kindly provide an example of the script? Thank you very much

David