Hi all,
Im having problems with my EJB QL statements. Im using MySQL as my database..
The SQL statement below works perfectly on MySQL:
select o.dateArrived, o.custName , o.IDCategory from tblMessages AS o WHERE o.IDCategory = "+categoryId+" and DATE_SUB( '"+dateReceived+"' , INTERVAL 2 DAY ) <= o.datArrived ORDER BY o.datArrived DESC
public List getData(String categoryId, String dateReceived){
return em.createQuery
("select o.dateArrived, o.custName , o.IDCategory"+
"from TblMessages AS o WHERE o.IDCategory = "+categoryId+" and "+
"and DATE_SUB( '"+dateReceived+"' , INTERVAL 2 DAY ) <= o.dateArrived,
ORDER BY o.datReceived DESC").getResultList();
}