How can I set DESC for sorting in php's medoo select?

WBOY
Release: 2016-08-18 09:16:27
Original
1737 people have browsed it

Use (MD() is a method I wrote to get medoo objects)

<code>MD()->debug()->select('items',[
    '[>]items_pic'=>['id'=>'item_id']
],['items.id','items_pic.src'],[
    'AND'=>[
        'items.uid'=>19,
        'items.is_delete'=>0
    ],
    'ORDER'=>'items.id DESC'
])
</code>
Copy after login
Copy after login

will output this sql statement, which is different from the Chinese document. The last order by does not include DESC. Why is this? The actual data found is indeed not in reverse order

SELECT "items"."id","items_pic"."src" FROM "items" LEFT JOIN "items_pic" ON "items"."id" = "items_pic"."item_id" WHERE "items"."uid " = 19 AND "items"."is_delete" = 0 ORDER BY "items"."id"

Reply content:

Use (MD() is a method I wrote to get medoo objects)

<code>MD()->debug()->select('items',[
    '[>]items_pic'=>['id'=>'item_id']
],['items.id','items_pic.src'],[
    'AND'=>[
        'items.uid'=>19,
        'items.is_delete'=>0
    ],
    'ORDER'=>'items.id DESC'
])
</code>
Copy after login
Copy after login

will output this sql statement, which is different from the Chinese document. The last order by does not include DESC. Why is this? The actual data found is indeed not in reverse order

SELECT "items"."id","items_pic"."src" FROM "items" LEFT JOIN "items_pic" ON "items"."id" = "items_pic"."item_id" WHERE "items"."uid " = 19 AND "items"."is_delete" = 0 ORDER BY "items"."id"

"ORDER" => ["item.id"=>"DESC"]

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!