View Full Version : database issues


d34db0lts
11-03-2006, 12:26 AM
thank you to anybody that bothered opening this thread...

this is my dilemma.

so i have a nasty database that has wrong data

this is basically the jist of it
ID date cartID
1 06/10 234
2 06/10 234
3 06/11 234
4 06/11 567
5 06/11 567

by the way the database is set up and the situation, row three's cartID is wrong and should really be 567.

now, i could look at the database and look where this problem occurs but that would take a long time and it's not really productive. so i'm trying to figure out a way to point out any record that creates the unique combination of date and cartID, because if the combination of date and cartID only happens once then i know something is up. Now i've tried using Distinct and First/Last/Top...so many queries in the sql viewer that i'm all confused and have no base query to work with anymore.

if anybody knows what sql code/lines i would need to display records like record 3 and then another sql code/lines that would allow me to change the value of cartID to the appropriate one that would be awesome.

once again, thank you for reading this.

gemma-the-husky
11-03-2006, 01:03 AM
firstly if you really have a table that has to have a duplicate value for two fields then you definitely have a normaliation issue.

One way to find these is to create a query with these two fields and then a third field concatenating them. Then change this to a totals query, and count the concatenated string - the ones with single rows will return a count of 1