显示收入,因为它是其他人 [英] Displaying revenue as it was somebody else

查看:108
本文介绍了显示收入,因为它是其他人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



如您所见,我的查询显示了活跃人士的姓名收入。



现在我想显示除显示内容之外的其他内容:



那些不活跃的人(主动='不')他们的收入:(SUM(Total_Price * Num_Of_Products))

将显示并添加到员工编号4

我的意思是它不会改变表格,只显示在查询中作为employee_code = 4或员工姓名= inv的收入(并不重要)



非常感谢



我尝试了什么:



从employees_new中选择First_Name,SUM(Total_Price * Num_Of_Products)作为E Inner加入销售作为S
$ E. $ b on E.Employee_id = S.Employee_Id

Where Active ='yes'

Group By First_Name

按SUM排序(Total_Price * Num_Of_Products)DESC

解决方案

所以更改:

 其中 Active = '  yes' 

 其中 Active = '  no'  AND  Employee_code =  4  


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

解决方案

So change:

Where Active = 'yes'

To

Where Active = 'no' AND Employee_code = 4


这篇关于显示收入,因为它是其他人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆