Originally posted by pachamama
I'm building a database with company info including revenue and number of employees and I want to get an output based on revenue per employee when both fields are fulfilled....
Can anyone please help re how to set up this calculation including validation that would not give an output if both fields are not fulfilled...
I'm guessing it isn't too much of a big brainer but for a bear with little brain and little techie skills I'm stumped so if anyone can start me off in the right direction it would be much appreciated
Ok I think you want the sum of revenue grouped by each employee? If so its something like this:
Select sum(rev.revenue), emp.emp_name
from revenue rev, employee emp
where rev.revenue is not null
and rev.emp_id = emp.emp_id
group by emp.emp_name
Assumes you have 2 tables, REV and EMP. Not sure if this is true - If it is in one table, you can take out the join and other table reference.
I dont understand exactly when either of the fields would be null. Explain a little more the 2 columns, what data they contain, and why you would expect a NULL value.