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

eliminate dups

Status
Not open for further replies.

leburg

Programmer
Feb 15, 2006
64
0
0
US
Need to create a view. I have a payhistory file and need to pull the invoices and corresponding custnums from it. Problem is the the payhistory files has multiple transactions on each invoice# so I'm getting back much replication of invoice#s, and custnum, correct data but I want and need only 1 of each not the replication to use the view to my advantage...

SELECT TOP 100 PERCENT Invoice, customer
FROM dbo.payhistory
WHERE (Invoice IS NOT NULL AND Invoice <> 1)
ORDER BY Invoice

11144 134
11144 134
11144 134
11122 90
11122 90
11122 90
11122 90

to

11144 134
11122 90

TIA!
 
Never mind I got it...Distinct...doh!
Thanks for viewing.
 
i always enjoy seeing people use "TOP 100 PERCENT"

it's so microsoftian

by the way, this is the ANSI SQL forum, and that is not part of the ANSI SQL language

next time, you might want to try forum183

r937.com | rudy.ca
 
Thanks for the tip. The server through in the header code. I'm winging it on the sql side, writing crystal reports and need a special view.

The question is half the answer. Thanks again for the link, I'll go there in the future.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top