-->
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.  [ 2 posts ] 
Author Message
 Post subject: Query help (mysql "left" operation)
PostPosted: Mon Aug 09, 2004 4:53 pm 
Newbie

Joined: Mon Jun 14, 2004 5:16 pm
Posts: 16
Location: New York
Hibernate version: 2.1
Name and version of the database you are using: Mysql 4.0.12

I'm trying to run the following query:

Code:
select left(business.name,1) count(business.name) from com.company.product.module.business.model.Business business where business.approved = 1 group by left(business.name,1)  order by business.name

and this fails complaining about 'undefined alias'.

When I change the
Code:
select left(business.name, 1)
to
Code:
select business.name
it works even though
Code:
group by left(business.name,1)
remains.


Full stack trace of any exception that occurs:
Unable to retrieve business alphabet: undefined alias: left [select left(business.name,1) count(business.name) from com.company.product.module.business.model.Business business where business.approved = 1 group by left(business.name,1) order by business.name ]


Thanks in advance,
Cagan


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 09, 2004 5:04 pm 
Beginner
Beginner

Joined: Thu Jul 22, 2004 2:15 pm
Posts: 35
seems like you are trying to use a db server native function. Some reading here might help:

http://www.hibernate.org/hib_docs/refer ... rysql.html

see if that helps.

_________________
--------------------------------------------------
To code or not to code... Is that a question?
--------------------------------------------------
Pritpal Dhaliwal


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

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.