Click here to Skip to main content
15,885,936 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

As you can see, my query below displays the revenue by name for those who active.

Now i want to display another thing in addition to what is displayed :

Those who aren't active ( active = 'no' ) their revenue : (SUM(Total_Price*Num_Of_Products))
will be displayed and added to employee number 4
I mean it sholud not change the tables, only display it in the query as revenue for employee_code = 4 or Employee name = inv (doesnt really matter)

Many Thanks

What I have tried:

Select First_Name, SUM(Total_Price*Num_Of_Products) from employees_new as E Inner join sales as S
on E.Employee_id=S.Employee_Id
Where Active = 'yes'
Group By First_Name
Order By SUM(Total_Price*Num_Of_Products) DESC
Posted
Updated 15-Jun-17 4:01am
v2

1 solution

So change:
SQL
Where Active = 'yes'
To
SQL
Where Active = 'no' AND Employee_code = 4
 
Share this answer
 
Comments
Member 13259807 15-Jun-17 10:03am    
Hi,

What i ment is : in addition to those who are active and displayed, i want to display another row which has all the revenues of the inactive names
and not instead of it

Thanks
OriginalGriff 15-Jun-17 10:15am    
Do you mean you want

Joe Smith yes $100.40 null
Mike Jones no null $323.89

If so, what is the difficulty?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900