Marek Kubis wrote:
> Thomas Mueller wrote:
>>> select distinct a0.word from contexts.words a0 where (a0.word =
>>> cast('apple' as varchar)) and ((select count(a2) from (select a0.word
>>> as a2) a3) = (select 1)) order by a0.word
>>>       
>>
>> Sorry I don't understand what the query should do. Could you explain
>> it please? Is it the same as:
>> select word from words where word = 'apple' group by word having count(*) = 
>> 1 ?
>>   
Actually it is ugly sql code generated from expression written in my
domain specific language.
It's meaning is the same as your expression above. It isn't very useful,
but similar expressions might be useful eg.

select a0.word from contexts.words a0 where a0.word ~ 'apple' and
((select count(a3) from (select a1.id as a3 from  contexts.wsenses a1
where a0.word = a1.word) a4) > 2) ;

"return words matching 'apple' from words table which are referenced in
wsenses table more than two times"

though all of them could be probably translated to the group by / having
form it was easier to generate and manage them in the form above.
>
>>> Is it intentional behavior of h2 engine or some kind of bug?
>>>     
>>
>> I tested your and similar queries with various databases but it only
>> works in PostgreSQL. While it can probably be made to work in H2, I
>> suggest to change the query so it works with all (or at least most)
>> databases.
>>
>>     
So It will be probably better to change my generator than your database
engine.
Thanks.

-- 
Marek Kubis


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to