两个表之间的单个查询,其字段上没有链接 [英] A single query between two tables without link on its fields
问题描述
SELECT
SUM(fieldname)AS T_Withheld
,SUM(fieldname)AS G_Income
,SUM(fieldname) + SUM(fieldname)+ SUM(fieldname)+ SUM(fieldname)AS Premium
,SUM(fieldname) - fieldnameC - (SUM(fieldname)+ SUM(fieldname)+ SUM(fieldname)+ SUM (fieldname))AS T_Income
,fieldnameA
,fieldnameB
FROM tablename A
GROUP
BY fieldnameA
,fieldnameB
,fieldnamec
和
>
选择fieldnameA,fieldnameB,fieldnameC,fieldnameD
来自tablename B
真的需要创意
SELECT
SUM (fieldname) AS T_Withheld
,SUM (fieldname) AS G_Income
,SUM(fieldname) + SUM (fieldname) + SUM(fieldname) + SUM(fieldname) AS Premium
,SUM (fieldname) - fieldnameC - (SUM(fieldname) + SUM (fieldname) + SUM(fieldname) + SUM(fieldname)) AS T_Income
,fieldnameA
,fieldnameB
FROM tablename A
GROUP
BY fieldnameA
,fieldnameB
,fieldnamec
and
select fieldnameA, fieldnameB, fieldnameC, fieldnameD
from tablename B
Really need ideas
推荐答案
没有链接你的意思是两个表之间没有公共字段吗?
如果是这样的话,两个select语句有什么问题?
By no link do you mean there is no common field between the two tables?
If that is the case what is wrong with two select statements?
您不必拥有连接表的链接。这两个表之间应该有类似的东西加入,对吗?
我认为如果你提供完整,正确的SQL语句会有所帮助。
You don''t have to have a link to join tables. There should be something similar between these two tables to join on, correct?
I think it would help if you gave full, correct SQL statement(s).
你怎么知道哪条记录对有什么记录?
- CK
How would you know which record pairs with what record?
-- CK
这篇关于两个表之间的单个查询,其字段上没有链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!