亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長(zhǎng)資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    thinkphp中distinct的用法是什么

    在thinkphp中,distinct()方法用于去除重復(fù)的值,能夠返回唯一不同的值,distinct方法的參數(shù)是一個(gè)布爾值,語法為“$Model->distinct(布爾值參數(shù))->field('name')->select();”。

    thinkphp中distinct的用法是什么

    本文操作環(huán)境:Windows10系統(tǒng)、ThinkPHP3.2版、Dell G3電腦。

    thinkphp中distinct的用法是什么

    TP中distinct()的用處主要是去除重復(fù)的值

    DISTINCT 方法用于返回唯一不同的值 。

    $Model->distinct(true)->field('name')->select();

    生成的SQL語句是:

    SELECT DISTINCT name FROM think_user

    示例如下:

    thinkphp中distinct的用法是什么

    顯示的是這樣的

    thinkphp中distinct的用法是什么

    在加入distinct的話:

    thinkphp中distinct的用法是什么

    顯示結(jié)果為

    thinkphp中distinct的用法是什么

    下面為貼出來的代碼

    $offernum = M('offer')->distinct(true)->where('order_id='.$order_id)->field('user_id,number')->select(); dump($offernum);

    推薦學(xué)習(xí):《PHP視頻教程》

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)