zoukankan      html  css  js  c++  java
  • laravel的一些查询语句

    刚开始使用这个框架还是有一些不一样的地方

    比如我之前想把那个sql语句写到查询里面。文档里面的写法是

    然后再百度上面找到的写法是可以写到select里面

    $sql="SELECT a.uid,
    substring_index( substring_index( a.data1, ',', b.help_topic_id + 1 ), ',',- 1 ) phone
    FROM 表名 a JOIN mysql.help_topic b ON b.help_topic_id < ( length( a.data1 ) - length( REPLACE ( a.data1, ',', '' ) ) + 1 )
    WHERE a.data1 IS NOT NULL and a.data1!=''";
    $data = DB::select($sql);
    另外就是在新增的时候
    insertGetId是插入一条数据可以进行使用。多条数据使用
    DB::table('users')->insert([
        ['email' => 'taylor@example.com', 'votes' => 0],
        ['email' => 'dayle@example.com', 'votes' => 0]
    ]);
     
  • 相关阅读:
    Java:day4
    Java:day3
    Java:day2
    Java学习的第一天
    void指针
    const* 和 *const
    指针数组和数组指针
    c++的const
    C语言基础总结
    C、C++、java中的static区别
  • 原文地址:https://www.cnblogs.com/cici1989/p/9809451.html
Copyright © 2011-2022 走看看