Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I have a calculated field in a table?

Status
Not open for further replies.

shaunacol

Programmer
Jan 29, 2001
226
0
0
GB
I would like to work out a salespersons personal best GP total (£) and store it in a field in a table - is that possible?

I know that the following query SQL brings back the highest GP for a person but I cant get that to work within a table (probably because I dont really know where to put it!)

SELECT First(CommHistory.TotalGP) AS BestGP, CommHistory.SAlesPersonID FROM CommHistory GROUP BY SalesPersonID ORDER BY First(CommHistory.TotalGP), CommHistory.SalesPersonID;
 
Yes, it is possible. But bad table design. You don't store calculated fields in tables because it's against normalization. Here's a beginner course on normalization:
Fundamentals of Relational Database Design
 
I suppose it is bad practise but I want to store a field called Personal Best GP and do not really want to have the staff change that every time someon gets a new personal best. I suppose I will have to calculate it in a query but I tried that and it made it really hard to do some of the other things I was trying to do....
 
I suppose I will have to calculate it in a query but I tried that and it made it really hard to do some of the other things I was trying to do....
Maybe you could explain what was made really hard when you produced First(CommHistory.TotalGP) AS BestGP in a query?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top