在SQL中,如何将两列的数据乘以第三列 [英] In SQL, how to multiply data of two columns for third column

查看:323
本文介绍了在SQL中,如何将两列的数据乘以第三列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将两列的数据相乘并在第三列中显示。

I want to multiply the data of two columns and show it in the third column.

例如:


1st Column: Quantity
2nd Column: Rate
3rd Column: Price

我想在用户输入数量和费率的数据时相乘,例如 Quantity = 2 rate = 50 在价格列中,我想提到100。

I want to multiply as user enters the data for quantity and rate like Quantity=2, rate=50 automatically in price column I want 100 to be mentioned.

使用C#,VS2010,SQL 2008

Using C#, VS2010, SQL 2008

编辑:我想在 DataGridView 中显示数据,可能的解决方案是什么,我使用了 DataAdapter DataSet 来更新数据库:

I want to show the data at the DataGridView what are the possible solutions, I used DataAdapter and DataSet to update the database:

this.table2TableAdapter.Update(testingDataSet);


推荐答案

SELECT QUANTITY, RATE, QUANTITY*RATE as PRICE
FROM YOUR_TABLE

这篇关于在SQL中,如何将两列的数据乘以第三列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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