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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When Distinct Won't Work 1

Status
Not open for further replies.

CptTom

Programmer
Jul 16, 2001
117
US
MS Access has a function called FIRST, which returns the first iteration of a result and looks like

SELECT Master.Part_No, First(Master.Part_Name) AS Part_Name
Group by Master.Part_No

I need to try the same thing. I am pulling repair parts lists from several maintenance shops, I have a part_no and part_name. However, it will be 3 - 6 months before I can get the master parts list loaded. Therefore, I am at the mercy of the trash each shop has put in. In other words, I can build a view grouping on Part_No, but I will get as many versions of part_name as there are in the table. I want a routine which will return a single iteration of the part_name. I really don't care if it is the first, last, longest, who-cares(lol).

How can I do this with SQL 2000??

Larry
 
Hi,

Try this....

SELECT Master.Part_No, Max(Master.Part_Name) AS Part_Name
Group by Master.Part_No

Hope it helps :)

Sunil
 
Thanks, I thought I tried that but must have been having a Monday moment.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top