db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Diego Zanga" <naar...@gmail.com>
Subject Re: Group By - problems
Date Mon, 05 Feb 2007 23:51:00 GMT
2007/2/5, Craig L Russell <Craig.Russell@sun.com>:
> Hi Diego,
>
> The message is correct and Derby is behaving as it should.
>
> If you are using GROUP BY, you are aggregating a number of rows into
> a smaller number of rows, so instead of e.g. 100 rows all of which
[..]
> So you could e.g. aggregate clienti.birthday to find the youngest and
> oldest clienti in each provincia using SELECT provincia, MIN
> (clienti.birthday), MAX(clienti.birthday) FROM clienti GROUP BY
> clienti.provincia but this doesn't sound like what you are trying to do.
>
>  From the looks of the query, you don't want the GROUP BY clause at
> all...

it was made to fix a problem with the query made by an <engine>,
however i've fixed the engine

the problem is the query was something like
select a.ID, a.name, b.name from a,b where a.idb=b.id group by a.id

<a.id isn't in b table>, so the group by fail (works with mysql but
not with derby)

this one works
select a.ID, a.name, b.name from a left join b on a.idb=b.id where
a.idb=b.id group by a.id

and the group by is no more needed
select a.ID, a.name, b.name from a left join b on a.idb=b.id where a.idb=b.id


cya, thx :-)
-- 
Diego Zanga
------------------------------
http://www.eLawOffice.it
http://www.blogstudiolegale.eu
http://www.javablog.eu
Skype NAARANI

Mime
View raw message