-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: "undefined alias or unknown mapping: MONTH"
PostPosted: Wed Mar 29, 2006 5:57 pm 
Newbie

Joined: Wed Mar 29, 2006 5:18 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.