Newbie Question - Sum of Various Fields

This is a discussion on Newbie Question - Sum of Various Fields within the MySQL Database forums, part of the Database Forums category; I am a little confused on how to do the following..... I have the foloowing fields: reservations price total_reservations available_seats ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-26-2008
Craig Barnes
 
Posts: n/a
Default Newbie Question - Sum of Various Fields

I am a little confused on how to do the following.....

I have the foloowing fields:
reservations
price
total_reservations
available_seats
total_seats
income_total
income_needed
payment_received

1 - In the 'total_reservations' field, I would like the sum of all of the
'reservations' fields.

2 - In the 'available_seats' field, I would like the sum of 'total_seats'
minus 'total_reservations' field.

3 - In the 'income_total' field, the sum of all 'price' fields.

4 - In the 'income_needed' field, the sum of a set number ($1100.00 for
example) minus the 'income_total' field.

5 - A PAID logo to display if the 'payment_received' field is not empty (or
does have a value in it).

Any help would be greatly appreciated.

Thanks,
Craig


Reply With Quote
  #2 (permalink)  
Old 05-26-2008
Paul Lautman
 
Posts: n/a
Default Re: Newbie Question - Sum of Various Fields

Craig Barnes wrote:
>I am a little confused on how to do the following.....
>
> I have the foloowing fields:
> reservations
> price
> total_reservations
> available_seats
> total_seats
> income_total
> income_needed
> payment_received
>
> 1 - In the 'total_reservations' field, I would like the sum of all of
> the 'reservations' fields.
>
> 2 - In the 'available_seats' field, I would like the sum of
> 'total_seats' minus 'total_reservations' field.
>
> 3 - In the 'income_total' field, the sum of all 'price' fields.
>
> 4 - In the 'income_needed' field, the sum of a set number ($1100.00
> for example) minus the 'income_total' field.
>
> 5 - A PAID logo to display if the 'payment_received' field is not
> empty (or does have a value in it).
>
> Any help would be greatly appreciated.
>
> Thanks,
> Craig


I'm a lot confused. Are these all fields in a database table? If so you have
a serious design problem since you have a mix of detail and summary level
fields. Your table should contain only the detail level fields (plus of
course a suitable key). The total fields should be created dynamically in a
query.

Also, mysql is a RDBMS, it stores data and allows you to retrieve it in
various ways. It does not "display" anything and so cannot display a logo.
If you are using a programming language to retrieve the data, you may be
able to use that to force whatever UI (user interface) you are using, to
display a logo.


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:10 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0