Richard a écrit :
Hello, I'm in the process of programming a customer area with a list
of subscriptions :
Reference | Title | Type | Date of first subscription | Expires
Each item in this list will have a link to it's details with will show
a list like this :
Subscribed on : date of first subscription
Renewed on : date of first renewal
Renewed on : date of second renewal
Renewed on : date of third renewal
Expires on : date when expires.
At the moment I have got three mysql tables :
------
1) Products
Reference | Title | Type
2) Subscriptions
number(autoincrement) | reference | date_begin
3) subscriptions details
number(autoincrement) | subscription_number | length(number of months)
------
To get the first table I would :
List subscriptions
For each subscription get list of "lengths" which I would add together
and then calculate expire date by :
Total "lengths" + date_begin
Which gives me the expire date.
However all this seems alot of queries and resources for such a small
list and as I have not started the programming yet and have not
created the tables either, I thought I might ask your advice to see if
you think this is the best way, or if you could think of a better way
of achieving the same result. Maybe there is a way to get the expire
date with mysql, or maybe I should rethink my tables?
I hope that everything is clear, and thanks in advance :)
Hi I might have found a better solution.
I could have one table for the latest details and another containing the
history.
I would still have two tables, but only one query when a customer wishes
to view his or her subscriptions and only one query when he or her views
the detail.
What would the best way to copy an entry from one table to another and
then change the entry value ? What is the best way to do this using a
minimum of queries?
To copy an entry from one table to another do you have to read the value
with one query and then insert the value to the other table with a
second query or does mysql (5.0) have a function to copy data from one
table to another.
Thanks in advance.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]