雄辩地使用from

时间:2020-09-16 05:22:56

标签: php laravel

我正在使用for i in range(len(rows)): indptr[rows[i]+1] += 1 indptr=np.cumsum(indptr)

将连接添加到数据库对象时,无法选择要连接的表。

Laravel Framework 6.16.0

在我现在使用 $symbol = DB::connection('mysql_prod')->select('companies') // "companies" is the table ->join('insider_transaction', 'insider_transaction.companies_id', '=', 'companies.id') ->join('persons', 'persons.id', '=', 'insider_transaction.persons_id') ->where('insider_transaction.transaction_date', '>=', Carbon::today()->subDays(3)->startOfDay()) ->orderBy('transaction_date', 'desc') ->distinct()->get('symbol'); 之前,在编码DB::table('companies')之前,我想知道如何将选定的表添加到雄辩的查询中。

感谢您的答复!

1 个答案:

答案 0 :(得分:1)

尝试添加table('companies')->select('companies.*')

  $symbol = DB::connection('mysql_prod')->table('companies')->select('companies.*') // "companies" is the table
            ->join('insider_transaction', 'insider_transaction.companies_id', '=', 'companies.id')
            ->join('persons', 'persons.id', '=', 'insider_transaction.persons_id')
            ->where('insider_transaction.transaction_date', '>=', Carbon::today()->subDays(3)->startOfDay())
            ->orderBy('transaction_date', 'desc')
            ->distinct()
            ->get('symbol');