Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Simple query that consumes all temporary space.
Jaap W. van Dijk wrote:
> On Tue, 25 Jan 2005 16:02:50 -0800, DA Morgan
> <damorgan_at_x.washington.edu> wrote:
>
> <snip>
>
>>You can't use GROUP BY and HAVING clauses without an aggregation.
Here is the OP's SQL statement:
SELECT T1.LINE LINE1, T2.LINE LINE2 FROM T T1, T T2
WHERE T2.LINE > T1.LINE
AND T1.TXT = T2.TXT
GROUP BY T1.LINE, T2.LINE
HAVING COUNT(*) >= 3
Define the group? There is none.
If it were written as:
SELECT T1.LINE LINE1, T2.LINE LINE2, COUNT(*)
FROM T T1, T T2
WHERE T2.LINE > T1.LINE
AND T1.TXT = T2.TXT
GROUP BY T1.LINE, T2.LINE
HAVING COUNT(*) >= 3
it would make sense.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)Received on Wed Jan 26 2005 - 12:59:01 CST
![]() |
![]() |