我在laravel框架中使用了eloquent。我想从表D中获得通过表B和表C与表A相关的模型。
有没有办法做到这一点?
下面是数据库中的情况:
以下是数据库的示例数据:
INSERT INTO A (idA) VALUES(1);
INSERT INTO A (idA) VALUES(2);
INSERT INTO A (idA) VALUES(3);
INSERT INTO B (idB, A_idA) VALUES(1, 1);
INSERT INTO B (idB, A_idA) VALUES(2, 2);
INSERT INTO C (idC, A_idA) VALUES(
我有下面的代码,它用错误- SQL命令编译,没有正确结束,在插入标记后创建或替换触发器trg_bc,为每一行声明sumMarks int;noCMarks int;
begin
select nbrMarks into noCMarks from Course where idC = :new.idC;
select count(idC) from Marks where idStd = :new.idStd and idC = :new.idC;
if (noCMarks = Marks) then
select sum(Mar
下面的查询只需要很长的时间,下面的谓词只用于获取唯一的记录,因此想知道是否有不同的方法可以重写相同的查询而不多次调用下面的谓词,以获得唯一的ID。
select max(c.id) from plocation c where c.ids = y.ids and c.idc = y.idc)
select max(cr.id) from plocation_log cr where cr.ids = yt.ids and cr.idc = yt.idc)
select max(pr.id) from patentpr where pr.ids = p.ids and pr.idc = p.id
我在尝试删除一些用户定义的函数时出现了这个错误。
Msg 3729, Level 16, State 1, Line 13
Cannot DROP FUNCTION 'dbo.testfn2' because it is being referenced by object 'testtable2'.
Msg 3729, Level 16, State 1, Line 14
Cannot DROP FUNCTION 'dbo.testfn' because it is being referenced
by object 'DF__t