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

zeroing out parts of duplicate records

Status
Not open for further replies.

lexis7

Programmer
Sep 23, 2002
26
US
Hi-

I have a find dups query set up, which returns 5 fields.
I want to zero out Field 1 and Field 2 on just the duplicates. I don't want to touch Fields 3-5 on these duplicates. Is this possible to do through SQL?

Thanks for any help.

lexis
 
Post your SQL or your select query. Does this query select all records that are dups or does it only return the extra records. I mean if there are five duplicate records is the first one the original and you are returning 2-5.



Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Here is my SQL:


SELECT
.[Tracking Code],
.[Clicks],
.[Cost],
.[Impressions],
.[Date],
.[Orso Type],
.[Store],
.[Orders],
.[Net Demand]
FROM TABLE
WHERE (((TABLE.[Tracking Code]) In (SELECT [Tracking Code] FROM
As Tmp GROUP BY [Tracking Code],[Clicks],[Cost],[Impressions],[Date] HAVING Count(*)>1 And [Clicks] =
.[Clicks] And [Cost] =
.[Cost] And [Impressions] =
.[Impressions] And [Date] =
.[Date])))
ORDER BY
.[Tracking Code],
.[Clicks],
.[Cost],
.[Impressions],
.[Date];


This selects all records that are dups. I want to keep the orginal record untouched. For all the other dup records I want to zero out the fields [Clicks] & [Cost] & [Impressions] and keep the rest of the fields the same.

Thanks for any help!
 
Generally, the concept is not in keeping with (properly) normalized record sets. If the fields are truly pawrt of the record, htey should be in the record. If they are simply related to the record, they should be in a seperate table, linked via an index (Key) to the parent.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
To break it down:

The three fields that I want to zero out have the same values

but the other fields contain different dollar values which i want to sum in an output(excel pivot)

I can't sum the first three fields because then it will double or triplicate the values.

see example below:

[CLICKS] [COST] [IMPRESSIONS] [ORDERS] [DEMAND]
255 1.25 2555 1 10.95
255 1.25 2555 2 36.89
255 1.25 2555 3 89.55

Total:
255 1.25 2555 6 137.39
 
and your point is?




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top