-->
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.  [ 1 post ] 
Author Message
 Post subject: HSQL how determine existence of an object in a collection
PostPosted: Mon Jun 28, 2004 3:32 pm 
Beginner
Beginner

Joined: Fri Jan 16, 2004 3:22 pm
Posts: 26
Hello all,

i had used the elements function before to determine existence of an object in a collection, as follows:

Code:
select count(distinct t)  from Topic as t, User as u  where t = some elements(u.temas)


that worked fine and was done using postgresql dialect.

Now, however i tried to do something similar on ms sql dialect and didn't work:

Code:
select count(a) from A as a   where not exists (from B as b where a = some elements(b.as) )


the native sql produced show that the elements function is returning all the properties of the table, not just the id:

Code:
select count(a0_.id) as x0_0_
from A a0_
where (not exists(
    select a1_.id
    from A a1_
    where (a0_.id = some(
            select ab.prop1, ab.prop2, ab.idA, ab.idB
            from AB ab
            where a1_.id=ab.idB))))


the point is to count the objects As, that don't belong to any B collection,
help will be deeply appreciated


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

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.