G
Guest
Hi!
I have been thinking what would be the best way to "flatten" a table. I
think the easiest way to explain what I'm searching is by a simple example.
Beware, this is only to show you the idea, this isn't an actual table of mine
Lets say that I would have a table "Donations". It would have fields
Firstname, Lastname (name of the donator) and fields Animals, Hospital and
School as the things one could donate to. Table could look like this:
Firstname Lastname Animals Hospital School
Gene Gray 500
Mary May 200
Gene Gray 10
Donald Duck 1000
Tina Simpson 500
Mary May 300
Gene Gray 200
I'd like to have results like this:
Gene Gray 700 10
Mary May 200 300
Tina Simpson 500
Donald Duck 1000
Every distinct donator would have a record that would have the amounts the
donator had donated. I know that I can make a select distinct -query to get
every donators I would have in the table, but how to calculate how much they
have donated?
Any suggestions are appreciated, and if someone would know how to make this
as fast as possible, I'd be very glad!
- Beginner -
I have been thinking what would be the best way to "flatten" a table. I
think the easiest way to explain what I'm searching is by a simple example.
Beware, this is only to show you the idea, this isn't an actual table of mine
Lets say that I would have a table "Donations". It would have fields
Firstname, Lastname (name of the donator) and fields Animals, Hospital and
School as the things one could donate to. Table could look like this:
Firstname Lastname Animals Hospital School
Gene Gray 500
Mary May 200
Gene Gray 10
Donald Duck 1000
Tina Simpson 500
Mary May 300
Gene Gray 200
I'd like to have results like this:
Gene Gray 700 10
Mary May 200 300
Tina Simpson 500
Donald Duck 1000
Every distinct donator would have a record that would have the amounts the
donator had donated. I know that I can make a select distinct -query to get
every donators I would have in the table, but how to calculate how much they
have donated?
Any suggestions are appreciated, and if someone would know how to make this
as fast as possible, I'd be very glad!
- Beginner -