优化sql
This commit is contained in:
parent
2e568a7cab
commit
dd87964ad7
|
@ -88,10 +88,10 @@ class Qinghaihu implements SyncPluginInterface
|
||||||
{
|
{
|
||||||
if(!empty($this->last_sync))
|
if(!empty($this->last_sync))
|
||||||
{
|
{
|
||||||
$sql = "SELECT x.* FROM xml x";
|
$sql = "SELECT x.* FROM xml x where x.id in (select id from normalmetadata)";
|
||||||
}else{
|
}else{
|
||||||
$sql = "SELECT x.* FROM xml x
|
$sql = "SELECT x.* FROM xml x
|
||||||
LEFT JOIN metadata m ON x.id=m.id
|
LEFT JOIN normalmetadata m ON x.id=m.id
|
||||||
WHERE m.ts_created > '{$this->last_sync}'";
|
WHERE m.ts_created > '{$this->last_sync}'";
|
||||||
}
|
}
|
||||||
$rs = $this->db->query($sql);
|
$rs = $this->db->query($sql);
|
||||||
|
|
|
@ -90,8 +90,8 @@ class Sanjiangyuan implements SyncPluginInterface
|
||||||
$sql = "SELECT * FROM xml where id in (select id from normalmetadata)";
|
$sql = "SELECT * FROM xml where id in (select id from normalmetadata)";
|
||||||
}else{
|
}else{
|
||||||
$sql = "SELECT x.* FROM xml x
|
$sql = "SELECT x.* FROM xml x
|
||||||
LEFT JOIN metadata m ON x.id=m.id
|
LEFT JOIN normalmetadata m ON x.id=m.id
|
||||||
WHERE m.ts_created > '{$this->last_sync}' AND m.id in (select id from normalmetadata)";
|
WHERE m.ts_created > '{$this->last_sync}'";
|
||||||
}
|
}
|
||||||
$sql = "SELECT * FROM xml where id in (select id from normalmetadata)";
|
$sql = "SELECT * FROM xml where id in (select id from normalmetadata)";
|
||||||
$rs = $this->db->query($sql);
|
$rs = $this->db->query($sql);
|
||||||
|
|
Loading…
Reference in New Issue