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

sql server programming

group:

Hel with Query Design


Re: Hel with Query Design Tom Moreau
11/14/2005 3:59:29 PM
sql server programming:
Try:

select
p.*
, q.CreationDate
, q.Value
from
Projects p
join Quotes q on q.ProjectNo = q.ProjectNo
join
(
select
ProjectNo
, min (CreationDate) CreationDate
from
Quotes
group by
ProjectNo
) x on x.ProjectNo = p.ProjectNo
and x.CreationDate = q.CreationDate

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com

[quoted text, click to view]

Hel with Query Design John
11/14/2005 8:53:12 PM
Can someone please help

I have two tables:

1.Project Table that holds a Unique Project No

2. Quotes table that holds the Project No, Quote Number and Creation date
and quote value. There are multiple quotes for each project.

I want to return Project No and one quote Value for each Project with the
earliest creation date.

Regards

John


Re: Hel with Query Design John
11/14/2005 10:51:24 PM
Thanks for your help Tom

[quoted text, click to view]

AddThis Social Bookmark Button