Thread: is grouping over many columns avoidable?

is grouping over many columns avoidable?

From
Holger Klawitter
Date:
Hi there,

I would like to do a query in order to retrieve a complete row
of a table maching a number of requirements being stored
in another table. The best I could think of was:

select
    x.id, x.1, x.2, ..., x.30
from
    x, y
where
    x.id = y.id and x.name like 'bla%' (y.attr=val1 or y.attr=val2)
group by
    x.id, x.1, x.2, ..., x.30
having
    count(*) = 2
order by
    x.value desc

The grouping looks pretty stupid, is there any faster way to
write a query like that (using 'in' and a subselect to grab the
ids from x made the program 10 times slower...)

With kind regards / Mit freundlichem Gruß
    Holger Klawitter
--
Holger Klawitter
holger@klawitter.de                             http://www.klawitter.de