Medoo查询条件+排序+LIMIT

2020年3月16日22:20:05 评论 2,148 次浏览
$database->debug()->select("book", "*", ["ORDER" => ["date" => "DESC"]]);
//SELECT * FROM `book` ORDER BY `date` DESC
$database->debug()->select("book", "*", ["view" => "1","ORDER" => ["date" => "DESC"]]);
//SELECT * FROM `book` WHERE `view` = '1' ORDER BY `date` DESC
$database->debug()->select("book", "*", [
        "AND" => [
            "type" => $_GET["type"],
            "view" => "1"
        ],"ORDER" => ["date" => "DESC"]
    ]);
    //SELECT * FROM `book` WHERE (`type` = '1' AND `view` = '1') ORDER BY `date` DESC

LIMIT

$datas = $database->select("dede_addonimages", [
    "aid",
    "taobaoid"
]
    ,[
    "OR" =>[
        "tklupdate[<]"=>"$isend",
        "tklupdate"=>0
    ]
    ,
        "ORDER" => ["aid" => "DESC"], "LIMIT" => [0,5]
    ]
);
weinxin
加我微信
微信扫一扫,加我微信好友,共同交流,共同进步! (备注:焦国强博客)
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: