>I'm about to create a piece of a project which which will be used to check
>for errors in data entry.  Every 500 records entered will prompt the user to
>check their work.  I have all of the triggers set up already.  The database
>is all Oracle, PHP 4.0.4 (1381 build).  What I would like to do is display
>all of the 500 records (no problem) and (here's where I could use some
>advice) highlight any records with a duplicate value in one particular
>field.
>
>Should I load all of the data into an array?  Should I skim through all the
>records, take notes, reset, and then run through them again?  Should I run a
>separate statement which searches for dupes and then match them against the
>whole body of records?
>
>I don't want code, just a voice of experience which could start me off
>right.
>
>Thanks,
>
>John

Sir, just off the top of my head;
If you can return the records in a different order than they were 
entered, then I would GROUP BY the field containing duplicates, so 
that duplicate data are grouped together. Then your app can iterate 
through the records and highlight anything where the same value 
appears sequentially. If your ORDER BY in your SELECT statement so 
that the records with duplicate values appear first or last, you app 
will only have to iterate through the duplicates, and can stop as 
soon as it stops finding duplicates.

A little more off the top;
If you can't return the records in a different order, the do a second 
query, GROUP BY the field containing duplicates, and return only 
groups with more than one record. Highlight any records in the 
display whose values match the values in the second query. (Match on 
either the duplicate values or the primary key values.)

Bob Hall

Know thyself? Absurd direction!
Bubbles bear no introspection.     -Khushhal Khan Khatak
MySQL list magic words: sql query database

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to