我需要在sakila数据库中找到电影的最长租期.我试过这个:
SELECT DISTINCT
customer.first_name
FROM
rental,
customer
WHERE
rental.customer_id = customer.customer_id
GROUP BY
rental.rental_id
HAVING
(
rental.return_date - rental.rental_date
) =(
SELECT
MAX(countRental)
FROM
(
SELECT
(
rental.return_date - rental.rental_date
) AS countRental
FROM
rental,
customer
GROUP BY
rental.rental_id
) AS t1
)
Run Code Online (Sandbox Code Playgroud)
但我收到错误:
有谁知道为什么?我使用了一个应该是聚合数据的列..我缺少什么
我要实现一个无名管道,我必须在父进程中执行该命令,而不是在他的任何一个孩子中执行.每个" - "等于一个管道("|")的调用,也是我有这个代码的赋值的一部分.谁能向我解释为什么它不起作用?
#include <stdio.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h> // for open flags
#include <time.h> // for time measurement
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
void my_exec(char* cmd, char** argv)
{
int pipefd[2], f;
if (pipe(pipefd) < 0)
perror("pipe creation failed");
f = fork();
assert(f >= 0);
if (f == 0) {
// inside son process - connecting STDOUT to pipe write
if (dup2(pipefd[1], STDOUT_FILENO) < 0)
perror("dup2 failed");
close(pipefd[0]);
close((int)stdout);
} …Run Code Online (Sandbox Code Playgroud) 我有这个脚本:
filePattern='sor.log*'
filePattern2='sor.SOR.log*'
myLocation=/opt/tradertools/omer
clientLocation=/opt/tradertools/omer/sor/from
clientName=vmonitorlmpa
clientUser=root
clientPass=triltest
export SSHPASS=$clientPass
sshpass -e sftp -oStrictHostKeyChecking=no -oBatchMode=no -b - $clientUser@$clientName << !
get $clientLocation/$filePattern2 $myLocation
get $clientLocation/$filePattern $myLocation
bye
!
Run Code Online (Sandbox Code Playgroud)
但如果filepattern2没有找到,它将退出.如何避免使用两个SFTP连接?
我是C的新人,我想要一些帮助.假设我需要在文件中存储仅6位数字.(假设int的大小等于4)使用文本文件或二进制文件会更有效(就内存而言)?我不确定如何面对这个问题,欢迎任何帮助