【问题标题】:Inner join statement using Medoo使用 Medoo 的内部连接语句
【发布时间】:2017-10-23 10:19:42
【问题描述】:

我在尝试通过 medoo 进行内部连接时遇到了真正的问题。查看我能找到的所有资源,下面的代码应该没有任何问题,但它只是空白。它也没有抛出任何错误。

"wp_ch_station",
["[><]wp_ch_statuses" => ["wp_ch_station.status" => "wp_ch_statuses.id"]],
["wp_ch_station.id", "wp_ch_station.name", "wp_ch_statuses.status", "wp_ch_station.time"],
["id[!]" => $client_id]

如果我将其更改为以下内容,我会得到“wp_ch_station”的完整输出,正如我所期望的那样。

$table_prefix . "ch_station",
["id", "name", "status", "time"],
["id[!]" => $client_id]

【问题讨论】:

  • 看起来它正在输出引号之间的句点。调试 sql 显示它正在输出 "wp_ch_station"."name"

标签: php mysql medoo


【解决方案1】:

对于复杂的查询,您始终可以使用查询而不是选择使用 Medoo 框架。

   $db->query('select a.c1,a.c2,b.c1,b.c2 from a inner join b on a.x=b.x where date<subdate(CURRENT_DATE,1)')->fetchAll();

有时编写查询更容易......

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-12
    • 2011-04-01
    • 1970-01-01
    • 2018-10-06
    • 2014-11-29
    • 1970-01-01
    • 2022-12-10
    • 1970-01-01
    相关资源
    最近更新 更多