Gordon - provided you have defined a unique index for these three fields (aka, a composite index, or a unique composite key), you should be able to do the INSERT and rely on a "constraint" violation exception to tell you when you've attempted to insert a duplicate record.
You can then handle the exception as appropriate (either update the existing record, or ignore the insert, or ...). This way, you're not fetching & scanning the results every time you try to insert - you're simply handling the exceptional case where a duplicate insert was attempted. Better yet, you're allowing the data base to enforce the unique-ness of its entities rather than having to enforce this concern in every piece of code that ever inserts to this table (or anyone who might otherwise attempt to insert to this table via a command line or other db access tool). Bear in mind, I'm much stronger in Oracle than MySQL, so take into consideration that the terms "constraint, composite, etc." are meant generically rather than specific to MySQL. Mike On 9/23/2006, "Gordon Stewart" <[EMAIL PROTECTED]> wrote: >On 9/24/06, Gordon Stewart <[EMAIL PROTECTED]> wrote: >> Hi, i have a table.. with 7-8 fields... >> >> Now, 3 of my fields, I want to be unique, however no INDIVIDUAL field >> will be unique... >> >> IE I can have values > >I've done the loop routine, & it seems to be working.... > >I'm not too concerned with speed - on this routine..... > >-- >G >NZ community groups - [EMAIL PROTECTED] >NZ-Website space offered. Community email addresses: Post message: [email protected] Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-list Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/php-list/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
