小编Pet*_*ete的帖子

仅当添加了ORDER BY时,查询才返回无结果

我有一个包含以下架构的表:

people_stages

id    |    person_id    |   stage_id   |   created
1     |    1            |   1          |   2013-09-01 00:00:00
2     |    1            |   2          |   2013-09-02 00:00:00
3     |    1            |   3          |   2013-09-03 00:00:00
Run Code Online (Sandbox Code Playgroud)

我创建了以下查询以选择按人员分组的最新阶段:

SELECT * 
FROM people Person
LEFT JOIN people_stages PersonStage ON PersonStage.person_id = Person.id
WHERE PersonStage.created = (SELECT MAX(people_stages.created) FROM people_stages GROUP BY person_id HAVING person_id = PersonStage.person_id);
Run Code Online (Sandbox Code Playgroud)

但是,如果我尝试在Person表中按ORDER BY字段,它工作正常:

SELECT * 
FROM people Person
LEFT JOIN people_stages PersonStage ON PersonStage.person_id = Person.id
WHERE PersonStage.created = (SELECT …
Run Code Online (Sandbox Code Playgroud)

mysql join

7
推荐指数
1
解决办法
486
查看次数

PECL和PHP构建目录

我正在尝试安装PECL包,我收到了这个错误.我不确定该怎么办,所以希望有人可以提供一些帮助:

# pecl install -f ssh2
WARNING: failed to download pecl.php.net/ssh2 within preferred state "stable", will instead download version 0.11.3, stability "beta"
downloading ssh2-0.11.3.tgz ...
Starting to download ssh2-0.11.3.tgz (23,062 bytes)
........done: 23,062 bytes
5 source files, building
running: phpize
Cannot find build files at '/usr/lib64/php/build'. Please check your PHP installation.

ERROR: `phpize' failed
Run Code Online (Sandbox Code Playgroud)

php linux shell redhat

3
推荐指数
1
解决办法
6240
查看次数

标签 统计

join ×1

linux ×1

mysql ×1

php ×1

redhat ×1

shell ×1