比较两个货币值域 [英] comparing two value of money field
本文介绍了比较两个货币值域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想比较两个单独表的两个字段!
例如tbl_User(用户编号,金额)和tbl_Product(用户编号,产品编号,金额)...
例如比较字段:金额和金额
这两个表中是否需要有一个关系?
请帮助我...
I want to compare two field of two separate table !
for example tbl_User (UserId, amount) and tbl_Product(UserId,ProductId, Pamount) ...
and for example comparing fields: amount and Pamount
is there a need to have a relation in this two table ??
please help me ...
推荐答案
否.
例如,这两个表之间没有正式关系:
No.
For example there is no formal relationship between these two tables:
SELECT S.[StudentId], S.Name, M.Amount , M.MissionID
FROM [Testing].[dbo].[Student] AS S, [Testing].[dbo].[myTable] AS M
WHERE S.StudentId=M.MissionID
这完全取决于您要比较的内容吗?假设您想找出每个用户的(Pamount + amount)之和,在这种情况下,您需要聚合函数并在两个字段的UserId之间进行联接.(这只是一个示例)
结论:仅当tbl_Product.Pamount和tbl_User.amount独立于UserId时,才需要加入.
希望这些信息对您有帮助,
谢谢
-Amit.
Hi,
it''s all depends upon what you would like to compare ? suppose you would like to find out sum of (Pamount+amount) for every user in that case you need aggregate function and joining between UserId of the both the field.(this is just an example)
Conclusion : you do not need joining only if tbl_Product.Pamount and tbl_User.amount is independent on UserId.
hope this information will help you,
thanks
-Amit.
这篇关于比较两个货币值域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文