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

Suppression of duplicate values in columns

Status
Not open for further replies.

gamcall

Programmer
Aug 23, 2000
24
0
0
GB
Hi there,
I've got a query which returns a result set like this:

ColA ColB ColC ColD
A1 B1 C1 D1
A1 B1 C2 D2
A1 B1 C3 D3
A2 B2 C4 D4

ie, multiple values of cols C & D for a value of A & B (which are 1 to 1). I want a result set of the form:

ColA ColB ColC ColD
A1 B1 C1 D1
C2 D2
C3 D3
A2 B2 C4 D4

ie, removal of the duplicate values of Cols A & B. Can anyone help? I've tried tricky combinations of UNION etc...

T.I.A,
GAM


 
You'll need to use a cursor in a procedure to do this. There are no SQL commands to compare values in a row to the previous row values.

Are you doing this for a report? If so, I recommend using a reporting tool like Crystal Reports or MS Access to produce the results you want. It will take less time to develop and
look better. Terry
 
Why you do not put them in different tables? John Fill
1c.bmp


ivfmd@mail.md
 
i want to do the same thing that gamcall is trying to do.
gamcall Did you solve this.?
thanks
lovalles
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top