由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - 一个single table 的 SQL QUERY
相关主题
SQL Server Trigger on System Base Table or Catalog View请教一个ACCESS的土问题
help about SQL for ACCESSask for help with a simple query!!!
SQL combine two columns from two different tables no shared (转载)请教一个SQL Query
Table Merge (SQL Server)help on this query
HELP: 如何实现 一个简单的Query我也问一个sql querry的问题
sql 请教请帮我看看,什么地方错了?
求教如何针对这种情况进行优化问一个转行到数据库方面的事,急求大家建议!
这个query怎么写?谢谢请教一下这个report的query应该怎么样写?
相关话题的讨论汇总
话题: count4话题: count23话题: count1话题: query话题: row
进入Database版参与讨论
1 (共1页)
d*******n
发帖数: 109
1
this is a single table query,
table looks like this:
column1 column2 column3 column4
1 0 1 0
0 1 1 1
1 0 0 0
1 1 1 1
...
four columns, each can be 1 or 0,
write one SQL query to get output looks like
TotalRow Count1 Count23 Count4
total row is the total row of table
count1 is the count of all row which column1 = 1 and the rest 3 columns are
0
count23 is the count of all row which column2 = 1 and column = 1 and column1
= 0 and column4 = 0
count4 is the count of all row which column4 = 1 and the rest columns are 0
so the above result should be like:
TotalRow Count1 Count23 Count4
4 0 0 0
如果上面的能用一个query解决,
能不能用同样的table,让输出是竖的,比如
TotalRow 4
Count1 0
Count23 0
Count4 0
谢谢
B*****g
发帖数: 34098
2
http://stackoverflow.com/questions/12628585/how-to-do-a-sum-ins

【在 d*******n 的大作中提到】
: this is a single table query,
: table looks like this:
: column1 column2 column3 column4
: 1 0 1 0
: 0 1 1 1
: 1 0 0 0
: 1 1 1 1
: ...
: four columns, each can be 1 or 0,
: write one SQL query to get output looks like

1 (共1页)
进入Database版参与讨论
相关主题
请教一下这个report的query应该怎么样写?HELP: 如何实现 一个简单的Query
这个 Oracle SQL 语句该这么写啊?sql 请教
有用phpMyadmin的吗,请教求教如何针对这种情况进行优化
最近写了不少SQL script,请大牛评价下属于什么水平这个query怎么写?谢谢
SQL Server Trigger on System Base Table or Catalog View请教一个ACCESS的土问题
help about SQL for ACCESSask for help with a simple query!!!
SQL combine two columns from two different tables no shared (转载)请教一个SQL Query
Table Merge (SQL Server)help on this query
相关话题的讨论汇总
话题: count4话题: count23话题: count1话题: query话题: row