Hi, this is my first post to this forum, I'm relatively new at nhibernate.
I'm getting "undefined alias or unknown mapping: MONTH", probably my HQL is wrong.
The HQL is something like
SELECT
NEW MonthlyConsumptionRowDV (
detail.OperationBaseWarehouseFrom.Id,
obw.OperationBase.Id, obw.Warehouse.Id,
detail.Product.Id, MONTH(transfer.TransferDate),
YEAR(transfer.TransferDate),
SUM(detail.Qty),
0,
obw.OperationBase.Description,
obw.Warehouse.Description,
detail.Product.Code,
detail.Product.Description
)
FROM
TransfersDetail detail
JOIN
detail.Transfer transfer
JOIN
detail.OperationBaseWarehouseFrom obw
WHERE
transfer.TransferType.Id IN (10, 11)
AND transfer.TransferDate > '20050301 0:0:0'
AND transfer.TransferDate < '20060301 0:0:0'
AND detail.Product.Family.Id IN (1, 2, 3, 4, 9, 10, 11, 12, 18, 19, 20, 23, 27, 30, 31, 32, 33, 34, 35, 38, 49, 52, 56, 71, 86)
AND obw.OperationBase.Id IN (1, 2, 3, 4, 6, 18)
GROUP BY
MONTH(transfer.TransferDate),
YEAR(transfer.TransferDate),
detail.Product.Id,
detail.OperationBaseWarehouseFrom.Id
If I do MONTH(x) in WHERE it's right, but it doesn't work (at least for me) in the SELECT, I get that exception, anyone has any idea what am I doing wrong?
Thanks you in advance
|