-->
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.  [ 4 posts ] 
Author Message
 Post subject: Subquery & mysql
PostPosted: Wed Mar 24, 2004 8:23 am 
Beginner
Beginner

Joined: Wed Nov 19, 2003 3:08 pm
Posts: 20
Hi!

Does subquery's need something special properties?

David says in:

http://forum.hibernate.org/viewtopic.php?t=927245

.. that "HQL will be converted approrpriately to multiple SQLs if subselects are not supported
by the dialect.", but still i get following exception message:

SEVERE: Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ( ripped. )

I use hibernate 2.1.1, mysql-connector-java-3.0.8-stable-bin driver (from www.ibiblio.com/maven/...), and mysql 4.0.18-2 (debian dpkg).

Artsi


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 24, 2004 9:23 am 
Beginner
Beginner

Joined: Tue Jan 27, 2004 8:33 am
Posts: 29
I think Mysql supports subqueries starting from version 4.1


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 24, 2004 9:51 am 
Beginner
Beginner

Joined: Wed Nov 19, 2003 3:08 pm
Posts: 20
Ok. Thank you about information, but i need to get this work with older version.

The sql query, which i need to get work, is something like this:
select * from A where a.key not in ( select key from B where B.key2 != '10')
.. or something like that.. actually i don't know does it work, but that's the idea.

Can i do with those joins?? i don't know much about SQL.

Artsi


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 24, 2004 11:37 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Try this
select DISTINCT A.* from A,B where a.key <> B.key OR B.key2 = '10'
I think it will return the same result.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.