两个表之间的单个查询,其字段上没有链接 [英] A single query between two tables without link on its fields

查看:61
本文介绍了两个表之间的单个查询,其字段上没有链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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屋!

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