求语句------简单

leileibaby 2004-12-09 10:58:46
table 1
客户名 交易金额 币种
1 500 人民币
2 30 欧元
4 4999 美圆
。。。。。。。。

table 2
币种 汇率
人民币 1
英镑 16
欧元 12
美圆 8
。。。。。。。。

需要返回的结果为交易金额 大于 400元人民币的客户名单(是外币的要折成人民币)
...全文
45 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
fornothing 2004-12-09
  • 打赏
  • 举报
回复
select table1.客户名 from table1 let join table2 on table1.币种=table2.币种 where table1.交易金额*table2.汇率 > 400
lsxaa 2004-12-09
  • 打赏
  • 举报
回复
晕倒 应该是乘的 呵呵

select a.客户名,sum(a.交易金额*b.汇率) as 交易金额
from table1 a ,table2 b
where a.币种=b.币种
group by a.客户名
having sum(a.交易金额*b.汇率)>400
jackluo1981 2004-12-09
  • 打赏
  • 举报
回复
select 客户名 from table 1,table 2 where table 1.币种=table 2.币种 and 交易金额*汇率>400)
子陌红尘 2004-12-09
  • 打赏
  • 举报
回复
select a.客户名 from table1 a ,table2 b where a.币种 = b.币种 and a.交易金额 * b.汇率 > 400
lsxaa 2004-12-09
  • 打赏
  • 举报
回复
select a.客户名,sum(a.交易金额/b.汇率) as 交易金额
from table1 a ,table2 b
where a.币种=b.币种
group by a.客户名
having sum(a.交易金额/b.汇率)>400

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧