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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 get min dates of various records

Author  Topic 

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-03-06 : 10:46:13
Hi I need to obtain the first invoice_date of all supplier.

Table:

Supplier_No, Invoice_Date
1234 13-10-91
1235 11-05-90
1234 10-09-90

required results:
1234 10-09-90
1235 11-05-90


I know you can use the min function, but it will only return the min from any supplier.

Any ideas how i can get my required results?

Thanks in advance!

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-03-06 : 10:52:19
[code]Select Supplier_No, Min(Invoice_Date) as Invoice_Date
From Table
Group by Supplier_No[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-03-06 : 11:10:59
Oops of course!

THanks a lot!
Go to Top of Page
   

- Advertisement -