多个表的SQLite语法

时间:2015-04-02 12:03:20

标签: php sql sqlite

这是我显示多个表的语法,但没有信息。谁能告诉我哪里错了?

$sql = "SELECT 'i'.*,
        't'.'name' AS 'type_name', 'c'.'name' AS 'client_name'
        FROM 'items' 'i'
        JOIN 'types' 't', 'clients' 'c'
        ON 't'.'id' = 'i'.'type', 'c'.'id' = 'i'.'client'
        ORDER BY 'i'.'date' DESC";

$result = $objDb->query($sql);
if (!$result) {

    throw new PDOException("Error Processing Request");

}
$result->setFetchMode(PDO::FETCH_ASSOC);
$items = $result->fetchAll();
$sql = "SELECT 'clients', 'types'
        FROM 'items', 'clients'
        ORDER BY 'id'";

$result = $objDb->query($sql);
if (!$result) {
    throw new PDOException("Error Processing Request");

}

0 个答案:

没有答案