和问题 [英] sum problem
问题描述
我有两张桌子
一张桌子包含有关用户的基本信息。
第二张桌子包含用户的金额信息。
i want用户数量的总和国家虎钳。我在用户表中有国家ID。
但在第二个表中有用户ID和金额信息。
如何获得用户数量的国家老虎钳。
如果有人有想法那么请帮助我。
i have two tables
one table contain the basic information about the users.
second table contain amount information of users.
i want to sum of amount of users Country vise. i have country id in users table.
but in second table have the user id and amount information.
how i can get the sum of users amount country vise.
if any one have idea then please help me.
推荐答案
你指的是表,假设有某种数据库是安全的吗?你能给出更多关于你正在运行的环境的信息吗
Purple
Hi,
You refer to tables, is it safe to assume there is a database of some sort ? Can you give a little more info on what environment you are running plse
Purple
i有两个表
一个表包含有关用户的基本信息。
第二个表包含用户的金额信息。
i想要金额的总和用户国家老虎钳。我在用户表中有国家ID。
但在第二个表中有用户ID和金额信息。
如何获得用户数量的国家老虎钳。
如果有人有想法那么请帮助我。
i have two tables
one table contain the basic information about the users.
second table contain amount information of users.
i want to sum of amount of users Country vise. i have country id in users table.
but in second table have the user id and amount information.
how i can get the sum of users amount country vise.
if any one have idea then please help me.
如果此用户ID在您可以制作的两个表格中重复。
userinfo table
user_id - userName - user_country_id
1001 - Mike - 5
1002 - Sam - 2
1003 - Jane - 5
amountinfo表
amt_id - user_id - 金额
1 - 1001 - 100
2 - 1002 - 150
3 - 1003 -250
if this user id is repeating in both the tables you can make it.
userinfo table
user_id - userName - user_country_id
1001 - Mike - 5
1002 - Sam - 2
1003 - Jane - 5
amountinfo table
amt_id - user_id - amount
1 - 1001 - 100
2 - 1002 - 150
3 - 1003 -250
hi
首先感谢您的回复。
现在我告诉你数据库的结构。
基本上我有三张桌子。
1。 country
此表包含以下字段。
id_zone , country_name
2。 user_info 。
此表包含以下字段。
id , user_name , id_zone
3。这个表包含以下字段。
id , id_user , 金额
金额表包含多个id_user
现在我想得到国家老虎钳用户数量的总和。
帮助我解决这个问题。
i将全部谢谢。
hi
first of all thanks for reply.
now i tell u the structure of data base.
basically i have three tables.
1. country
this table contain the following fields.
id_zone, country_name
2. user_info.
this table contain the following fields.
id, user_name, id_zone
3. amount.
this table contain the following fields.
id, id_user, amount
amount table contain multiple amount of id_user
now i want to get the sum of amount of users country vise .
help me about this problem.
i will be thanks full .
这篇关于和问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!