Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » GROUP BY on a datetime field without time part(GROUP BY on a datetime field without time part)
GROUP BY on a datetime field without time part [message #1397913] Thu, 10 July 2014 10:35 Go to next message
Clementi Ursula is currently offline Clementi UrsulaFriend
Messages: 6
Registered: July 2013
Junior Member
Hello

all i want is to make that SQL by Exclipse (2.3.2 ) with a ReportQuery.

select CAST (P_DATUM_LIEFERUNG as DATE), COUNT(*) from LIEFERAUFTRAG group by CAST (P_DATUM_LIEFERUNG as DATE) ;


This field "p_datumLieferung" is on a SQLServer-Datbase and is filled with date and time parts.
But i want the Counts only daily.

If tried something like this

repQuery.addAttribute("Datum", expBuilder.get("p_datumLieferung").getFunction("CAST");

But how to tell exclipse the " as Date" clause ? (The "as" Funktion does not help me).

Can anybody help me ?

Regards

Ursula Clementi

Re: GROUP BY on a datetime field without time part [message #1400633 is a reply to message #1397913] Mon, 14 July 2014 13:36 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1060
Registered: July 2009
Senior Member
Have you tried the cast method on Expression, expBuilder.get("p_datumLieferung").cast("DATE")?

Best Regards,
Chris
Re: GROUP BY on a datetime field without time part [message #1400670 is a reply to message #1400633] Mon, 14 July 2014 14:46 Go to previous message
Clementi Ursula is currently offline Clementi UrsulaFriend
Messages: 6
Registered: July 2013
Junior Member
Hello Chris,

the function cast() does not exists (in my Exclipse Version 2.3.2.v20111125-r10461).

If i try to use the "as" function like this

repQuery.addGrouping(exBuilder.get("p_datumLieferung").as(java.sql.Date.class));

the query does not change (means the complete date Object with time part is used for grouping).

This is for my opinion because i tell exclipse to use Java.sq.Date , which has in difference to SQLServer type DATE, a time part in the object.



Best Regards,
Ursula

Previous Topic:how to implement join for Same table
Next Topic:read blob as byte array issue
Goto Forum:
  


Current Time: Sat Apr 25 12:57:58 GMT 2015

Powered by FUDForum. Page generated in 0.02970 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software