当我将对象E与组一起使用时,系统会返回
““ where子句”中的未知列“ t0.idEmpresa””
如何解决此问题并从数据库中获取必要的值?
带有错误的代码:
# 'dummy' from to get access to headers/libs of bottom layer in build layer
FROM mylib as mylib
FROM gcc as build
WORKDIR /build
# copy source files for this layer
COPY *.c ./
# copy headers and libraries from mylib - I DON'T LIKE THIS
COPY --from=mylib /usr/lib/libmylib.so /usr/lib
COPY --from=mylib /usr/include/mylib.h /usr/include
RUN gcc -o hello hello.c -lmylib
# Stage 3: create executable image
FROM mylib
COPY --from=build /build/hello /
# run main executable
CMD ["./hello"]
代码没有错误:,但是此代码从总计中返回了错误的值...
(from e in Empresas
where e.Segmento == "comida estranha"
select new {
e.NomeFantasia,
e.RazaoSocial,
valor = (from f in Feedbacks
where e.IdEmpresa == f.IdConsultoria || e.IdEmpresa == f.IdContratante
select f.IdFeedback).Count(),
total = (from f in Feedbacks
where e.IdEmpresa == f.IdConsultoria || e.IdEmpresa == f.IdContratante
join r in Respostas on f.IdFeedback equals r.IdFeedback
group r by r.IdFeedback into x
select new {
x.Key
}).Count(),
}).ToList()
obs。:我正在使用LINQPad进行测试,但是在C#上也会显示错误。
obs²。: VALOR 有效,只有 TOTAL 无效。
答案 0 :(得分:1)
由于这个原因,您无法为变量“ valor”和“ total”分配类型。
(from e in Empresas
where e.Segmento == "comida estranha"
select new {
e.NomeFantasia,
e.RazaoSocial,
var valor = (from f in Feedbacks
where e.IdEmpresa == f.IdConsultoria || e.IdEmpresa == f.IdContratante
select f.IdFeedback).Count(),
var total = (from f in Feedbacks
where e.IdEmpresa == f.IdConsultoria || e.IdEmpresa == f.IdContratante
join r in Respostas on f.IdFeedback equals r.IdFeedback
group r by r.IdFeedback into x
select new {
x.Key
}).Count(),
}).ToList()
答案 1 :(得分:1)
尝试一下:
Matrix B = A;
答案 2 :(得分:0)
我没有足够的声誉来发表评论,所以答案-
我相信您正在尝试针对已为其基础表创建了模型的某些数据库运行此查询。
查看错误和LINQ查询,看起来您的模型与数据库表结构不同步。
编写此查询后,是否更改了列名?如果是,则重新生成模型,它将在编译时将您引向查询错误。