Ask the Expert

Multiplying fields from different tables

I am trying to multiply two single fields from two different tables and put that answer into a new field in a table. I am trying to estimate the individual Project Costs by taking the Techs rate in the Users table and multiplying it by the Techs individual hourly rate. Each tech has a different hourly rate. The cost will then be displayed for that particular Project Name. Every Project Name has one technician and it is not allowed to have multiple names of Projects. I've been looking online for a week now, and in books, and there seems to be no answer. Help!

    Requires Free Membership to View

Well, let's see if I have it right and can help out. The way I read your questions the two tables would look something like this:

USER
-----
Tech
TechRate

PROJECT
--------
ProjName
Tech
TechIndividualHourlyRate
You want to multiply TechRate by TechIndividualHourlyRate when PROJECT.Tech equals USER.Tech, correct?

How about this?

SELECT P.ProjName, U.TechRate * P.TechIndividualHourlyRate 
FROM   USER U,
       PROJECT P
Or did I miss something?

This was first published in October 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: