我有一个查询,如果有连接,则平均创建和取消日期之间的差异。查询在
下面select avg(TIMESTAMPDIFF(DAY, users.created_at,subscriptions.canceled_at)) as total from users
join subscriptions on users.id = subscriptions.user_id
我想要做的是,如果没有连接使用NOW()而不是cancel_at,然后平均两个mysql查询以获得平均天数。我该怎么做?
答案 0 :(得分:3)
void reverse(char line[]) {
char temp;
int i, j;
for (j = 0; line[j] != '\0'; ++j)
;
--j;
if (line[j] == '\n') {
--j;
}
for (i = 0; i < j; ++i, --j) {
temp = line[i];
line[i] = line[j];
//This statement is the one in which I dont understand it's function
line[j] = temp;
}
}
应该可以解决问题:
left join