Welcome Guest [Log In] [Register]
Add Reply
1 table minus another!; Heres a pickle for u guys!
Topic Started: Mar 9 2009, 09:28 AM (295 Views)
PauloMillerz
Member Avatar

OK next weekend i have a challenge to overcome in my Football project and wondered if you guys had any ideas. I haven't looked it up myself yet, but any advice on where to start looking would be useful :)

Right. I have a set of data that is continuously updating (Player stats). Every week I am taking a "Screenshot" of that data i.e. how it stands at the end of every week.

What I need to do is take week 1 away from week 2, to get the total points obtained in week 2. All this data is stored in mySQL tables within the same database.

Any ideas?
If you like... RATE IT!! Add to my reputation to the left?
Quote:
 
Bidet to you sir!

Posted Image
Offline Profile Quote Post Goto Top
 
Darksorrow131

How exactly are your tables designed?
If you have a record for each week for each player, then it should be relatively straightforward, but maybe your data is stored in some other way that could make things harder :P
(let loop () (loop))
((lambda (x) (x x)) (lambda (x) (x x)))
(let ((k #f)) (call/cc (lambda (cc) (set! k cc)) (k))
((call/cc call/cc) (call/cc call/cc))

-- Infinite loops are awesome! --
Tell me if you have other awesome infinite loops!
Offline Profile Quote Post Goto Top
 
PauloMillerz
Member Avatar

well each player has an entry in the table, and the table has many data fields... so prob not easy...

EDIT: Could I output the data into a cookie.. then pull the data from the cookie into a new table? hmmm
Edited by PauloMillerz, Mar 12 2009, 09:27 AM.
If you like... RATE IT!! Add to my reputation to the left?
Quote:
 
Bidet to you sir!

Posted Image
Offline Profile Quote Post Goto Top
 
Darksorrow131

What exactly does the database table look like?
(let loop () (loop))
((lambda (x) (x x)) (lambda (x) (x x)))
(let ((k #f)) (call/cc (lambda (cc) (set! k cc)) (k))
((call/cc call/cc) (call/cc call/cc))

-- Infinite loops are awesome! --
Tell me if you have other awesome infinite loops!
Offline Profile Quote Post Goto Top
 
PauloMillerz
Member Avatar

P N C V M G A C P+ P- Y R S B P
GK Schwarzer FU 4.6 2520 0 0 25 1 0 0 0 107 7 131
GK Van der Sar MU 6.4 2191 0 0 10 0 0 0 0 55 0 129
GK Cech CH 6 2250 0 0 16 0 0 0 0 63 7 123

Thats the outputted table.. there are 2 of these with the same fields..

This data updates once a week so I need to be able to take table2 away from table1.. to get the difference...
If you like... RATE IT!! Add to my reputation to the left?
Quote:
 
Bidet to you sir!

Posted Image
Offline Profile Quote Post Goto Top
 
Darksorrow131

So if I understood correctly, you have a table for each week?
The easiest solution would be to make them all into a single table - since the data are of the same form, they shouldn't be in different tables.
If for some reason you can't change the table design, then you might be able to do something like this:
Code:
 
SELECT thisweek.player_name, thisweek.points - lastweek.points
FROM thisweek INNER JOIN lastweek ON thisweek.player_id = lastweek.player_id

where you should substitute "thisweek" and "lastweek" for the real names of your tables.

This will fail if a player is missing in one of the tables but not the other for some reason.
(let loop () (loop))
((lambda (x) (x x)) (lambda (x) (x x)))
(let ((k #f)) (call/cc (lambda (cc) (set! k cc)) (k))
((call/cc call/cc) (call/cc call/cc))

-- Infinite loops are awesome! --
Tell me if you have other awesome infinite loops!
Offline Profile Quote Post Goto Top
 
PauloMillerz
Member Avatar

Not sure if that would work in my situation..

Putting them into 1 table is not realistic in this situation either...

Thanks for the help though..

I found a work around for it at the moment so I will come back to the issue later...
If you like... RATE IT!! Add to my reputation to the left?
Quote:
 
Bidet to you sir!

Posted Image
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Web-Based Programming Support · Next Topic »
Add Reply

Banner and Logo by TheKeith