我有以下结果
A B C
1 2 3
如何获得结果
title1 title2
A 1
B 2
C 3
我的查询是这样的
select
sum(if(d =4,1,0)) AS 'A',
sum(if(d = 4 and (datediff(curdate(), r_date)=1),1,0)) AS ' B',
sum(if(d = 1 and (datediff(curdate(), r_date)=2),1,0)) AS ' C'
from delay ;
答案 0 :(得分:0)
您似乎正在尝试在MySQL中移植表格。一种方法是使用一系列联盟:
x <- matrix(seq_len(100),10,10)
x[,1] <- letters[1:10]
y <- x
for (i in 1:nrow(x)) {
for (j in 2:ncol(x)) {
y[i,j] <- x[max(i-4,1),j]
}
}