Hi Justin,
this is really very frustrating: Every time I think I spotted a bug, a
flaw, or a deficiency it just turns out to be a mistake in my thinking!
This thing is perfect, apparently, awesome, great, wonderful!
It certainly saved my ass with this project.
Thanks for pointing out subQuery, I hadn't come across that one yet.
Many, many thanks
Günther
Justin Bailey schrieb:
> I came up with this SQL to represent what you want:
>
> select col1, count(col2)
> from (select col1, col2
> from table1
> group by col1, col2)
> group by col1
>
> You need to use the "subQuery" operator:
>
> query = do
> inner <- subQuery $ do
> t1 <- table table1
> unique
> project $ table1 ! col1 << col1,
> table1 ! col2 << col2
> project $ t1 ! col1 << col1 #
> t2 ! col2 << count(col2)
>
> I think that would do it. Did you figure it out?
>
> On Fri, May 1, 2009 at 10:41 AM, Guenther Schmidt <gue...@we...> wrote:
>
>> Hi Justin,
>>
>> lets say in the inner query I select 2 columns. There will be some
>> duplicates due to identical value pairs in cols 1 & 2.
>>
>> I will eventually only select col 1 and the count of *distinct* pairs of col
>> 1 & 2.
>>
>> Using:
>>
>> select col1, count (col2) ... naturally includes the duplicates, which I
>> don't want.
>>
>> How can I do that?
>>
>> Günther
>>
>>
>>
>>
|