如何在文本框C#代码中进行操作 [英] How I can make my operation in a textbox, C# code
问题描述
我想在我的表中计算一个列的总数,条件如下:当我用(识别)搜索时,我有totale_price:
< br $>
这是我的Sqlrêquete
SELECT SUM(价格)AS total_Price from nom_table where visible ='0' GROUP BY identify ='..';
我尝试过:
在textBox中进行操作,C#代码
i want to calculate a totale of a column in my table, with this condition: when i search with (identif) i have had the totale_price :
this's my Sql rêquete
SELECT SUM(Price) AS total_Price from nom_table where visible = '0' GROUP BY identif='..';
What I have tried:
make my operation in a textBox, C# code
推荐答案
SQL GROUP BY不包含条件:它是列列表(通常只有一列,列表在添加更多列时扩展组的数量,而不是细化它。)
所以这可能有用:
SQL GROUP BY does not include conditions: it's a column list (and normally just one column, the list expands the number of groups as you add more columns, not refines it).
So this might work:
SELECT SUM(Price) AS total_Price FROM nom_table WHERE visible = '0' GROUP BY identif
但请记住GROUP BY将为每个不同的行创建单独的行分组列中的值:如果您在整个表的总数之后,则根本不使用GROUP BY:
But do remember that GROUP BY will create separate rows for each distinct value in the grouping column: if you are after a total for a whole table, then don't use GROUP BY at all:
SELECT SUM(Price) AS total_Price FROM nom_table WHERE visible = '0' AND identif = '..'
可能是更好,因为它为所有匹配的行返回单个值。
Might be better as it returns a single value for all matching rows.
这篇关于如何在文本框C#代码中进行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!