Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 GROUP BY FUNCTIONS

Author  Topic 

rahulmalhotra26
Starting Member

23 Posts

Posted - 2008-01-25 : 04:37:45
guys just a small help ..

i am selecting columns and i dont want to put them in group by clause,,

for integers i can use
select max(salary), account no from tablename group by accountno
this works

but in case of varchar what can i use, so i dont have to declare the column in group by?? for example for column like last_name

Rahul

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-01-25 : 04:56:37
What are you trying to achieve. Provide some DDL,sample data and explain what you want from that data.

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-25 : 09:17:42
This can be achieved in number of ways by using subqueries,aggregated functions like MIN,MAX,using DISTINCT,derived tables etc. It depends on your requirement. So as suggested post your table DDL,sample data and expected output to get quick soln.
Go to Top of Page
   

- Advertisement -