本文介绍了sql count列数据,求助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 你好,首先我想道歉我说英语不合适.. 即时通讯试图让sql querry 来计算2个不同的列中的数据...... 的例子.. 表名:table 列名ItemToCount(int) ItemToCount中的有2行,第一行是3行,另一行是4行... 这是我的命令: hello, 1st of all i would like to appologise that i can't speak proper english..im trying to make a sql querryto count 2 different data from a column...for an example..table's name: tablecolumn name ItemToCount (int)in ItemToCount got 2 rows, first one is 3 and another one is 4...this is my command :select count(*) as NewItemToCount from table where ItemToCount = 3 and ItemToCount = 4 除了我还尝试这个命令,即使我知道它不会工作因为我使用整数而不是字符串或者字符 besides that i also try on this command even i know it won't work because im using integer but not string or characterselect count(*) as NewItemToCount from table where ItemToCount = '3' and ItemToCount = '4' 但我得到的结果是 NewItemToCount = 0 任何人都可以更正我的命令,以便我可以获得2我的NewItemToCount but the result i get isNewItemToCount = 0anyone can correct my command so that i can get 2 for my NewItemToCount推荐答案 select count(*) as NewItemToCount from table where ItemToCount = 3 and ItemToCount = 4 it将仅返回0 it will return only 0select count(*) as NewItemToCount from table where ItemToCount = 3 or ItemToCount = 4 select count(*) as NewItemToCount from table where (ItemToCount = 3 or ItemToCount = 4) 这篇关于sql count列数据,求助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-10 06:57