Home » SQL & PL/SQL » SQL & PL/SQL » Query with group by
Query with group by [message #199009] Thu, 19 October 2006 11:22 Go to next message
renafi
Messages: 42
Registered: October 2006
Member
Hi. I cant do this query?

select field1, field2, count(*), (select min(field_x) from table1 where table1.field_y=table2.field1) as result
from table as table2
group by field1, field2, result


I tried the same without the group by,and the count(*) and it worked. Whats wrong? I really need the group by.

Please help
Re: Query with group by [message #199021 is a reply to message #199009] Thu, 19 October 2006 12:06 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
select field1, field2, cnt, 
      (select min(field_x) from t1 where t1.field_y=t2.field1) as result
  from (select field1, field2, count(*) cnt
          from table as table2
         group by field1, field2) t2;
Previous Topic: blob
Next Topic: instance names
Goto Forum:
  


Current Time: Fri Dec 09 21:40:13 CST 2016

Total time taken to generate the page: 0.11933 seconds