-->
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: How can i execute query like "SELECT 1=1"
PostPosted: Sun Dec 19, 2010 4:57 am 
Newbie

Joined: Sun Dec 19, 2010 4:49 am
Posts: 1
We want to do some query like this:

We have a subquery which generate a set:
Code:
SELECT s.id FROM Something s WHERE s.xxx = 1


The result is a big set. And we want to know if a specific object is in this set. before we start using hibernate, we have written this:
Code:
SELECT 150 IN (SELECT id FROM something WHERE xxx = 1)

150 is the id we want to test whether it is in the set.

We try something like that:
Code:
SELECT 150 IN (s.id FROM Something s WHERE s.xxx = 1)


but it's not work.

Please help.


Top
 Profile  
 
 Post subject: Re: How can i execute query like "SELECT 1=1"
PostPosted: Mon Dec 20, 2010 4:20 am 
Regular
Regular

Joined: Fri Nov 12, 2010 4:13 am
Posts: 81
Location: India
It should be something like this,

Code:
select column_name from table_name where 150 in (SELECT s.id FROM Something s WHERE s.xxx = 1)



Maybe this can help you.

_________________
Thanks & Regards,
Chirag


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.