【发布时间】:2017-09-25 15:44:00
【问题描述】:
我是 Laravel 的新手,但我想创建这个查询(MySQL):
SELECT
*
FROM
(
SELECT
ce.empresa_id,
CONCAT(ce.nombre, ' ', ce.apellido) AS nombre,
ce.grupo_contable
FROM
cliente_empresa AS ce
UNION
SELECT
cc.empresa_id,
cc.nombre,
cc.grupo_contable
FROM
cuenta_contable AS cc
UNION
SELECT
cci.empresa_id,
cci.grupo_iva AS nombre,
cci.cuenta_contable AS grupo_contable
FROM
cuenta_contables_iva AS cci
) AS cuentasContables
WHERE
cuentasContables.empresa_id = 1
AND (cuentasContables.nombre LIKE '%a%'
OR cuentasContables.grupo_contable LIKE '%%')
查看文档我找不到正确的方法。谢谢。
【问题讨论】:
-
这里有你需要的一切laravel.com/docs/4.2/queries
-
@Maantje prntscr.com/gpixdv
-
您已经尝试过什么(任何代码?),我愿意提供帮助,只是希望看到您的努力。
-
pastebin.com/6U9N7VLV 谢谢,抱歉,我忘了发这个。运行该代码时我得到了这个:prntscr.com/gpj3uo
标签: php mysql laravel orm eloquent