Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

group by

Status
Not open for further replies.

maheswarkv

Technical User
Apr 24, 2006
6
US
hi..

I have a doubt on Group by clause...can anybody explain to me...

I have 2 tables..both emp and dept like this:

empno ename deptno
------------------
1 A 10
2 B 20
3 C 10
4 D 10

Deptno Deptname
---------------

10 Comp
20 Phy

If i said a query like this i m getting an error messae. can u check it pls:

select * from emp group by deptno;

can u tell me y? can't we group like this?

Thank u in advance..
 
The rules say that you can't GROUP BY when your select clause specifies ALL fields (i.e. *). You would need to specify the fields that you want and then use an aggregate function(s) to select which values you want for the ungrouped fields.

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top