小编Wah*_*sei的帖子

Laravel Eloquent在子查询中带有两个“ WHERE NOT IN”

我有这个查询,我很难在Laravel雄辩的ORM中编写查询。

感谢有人可以提供帮助。

这是SQL表达式:

SELECT DISTINCT cust, cust_no FROM delivery_sap 
WHERE cust NOT IN ( SELECT cust_name FROM customer) 
AND cust_no NOT IN ( SELECT cust_code FROM customer)
Run Code Online (Sandbox Code Playgroud)

mysql laravel eloquent

9
推荐指数
3
解决办法
7070
查看次数

mysql error 'NULL' at line 1

I got this error when tried to execute this:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1

Can't seems to find what is the problem. Appreciate if anyone can help

SET @sql = NULL;

SELECT
  GROUP_CONCAT(
    DISTINCT CONCAT (
      "SUM(IF(DATE(FROM_UNIXTIME(machine_stop)) = '",
      DATE(FROM_UNIXTIME(machine_stop)),"' ,
      (machine_start-machine_stop)/3600, 0)) AS ",
      DATE(FROM_UNIXTIME(machine_stop))
    )
  ) INTO @sql
FROM
  downtime_data
WHERE
  DATE(FROM_UNIXTIME(machine_stop)) …
Run Code Online (Sandbox Code Playgroud)

mysql null

4
推荐指数
1
解决办法
5487
查看次数

标签 统计

mysql ×2

eloquent ×1

laravel ×1

null ×1