all groups > sql server programming > november 2006 >
You're in the

sql server programming

group:

How to update first Record


How to update first Record Sundara Murthy
11/17/2006 10:13:01 PM
sql server programming:
Dear Experts,

I have the table it looks like

Table1
Cmpny_Name Anxtr_Num Recvd_Date Qty Item_Desc OGR_Date
AA 01 Null 10
Item1 01/04/2006
AA 01 Null 20
Item2 01/04/2006
AA 02 Null 10
Item3 01/05/2006
AA 02 Null 10
Item4 01/05/2006

The result should be the following one

Results
Cmpny_Name Count of Anxtr_Num First_OGR_Date
AA 02 01/04/2006

Thanks

Regards
RE: How to update first Record Omnibuzz
11/17/2006 11:17:01 PM
Are you looking for count of Anxtr_Num or max of it?
Anyways.. here is the query that calculates both.. use whichever is
necessary..

select
Cmpny_Name,
Count(distinct Anxtr_Num) as countAnxtr_Num,
max(Anxtr_Num) as maxAnxtr_Num,
min(OGR_Date)
from table1
group by
Cmpny_Name


Hope this helps!
--
-Omnibuzz

http://omnibuzz-sql.blogspot.com/

AddThis Social Bookmark Button