Zaid, Shaikh wrote: > I have a redundant database of almost 1,000,000 records. I need a query to delete all redundant records from the database but the problem is that, when i issue "DELETE FROM userLoginInfo WHERE userName = user". it deletes all the records of "user". I need to preserve one record from them. first backup old (original database)!! 1. you can use phpMyAdmin and run this query: SELECT DISTINCT * FROM userLoginInfo 2. and then dump the result or copy it to another (temporary) database 3. make sure you get the data you want 4. delete all record from old database 5. restore or copy database that we get from step 2. finish.. -- Markus ---------------------- RevTI Web Hosting http://www.RevTI.com ---------------------- PHP Data object relational mapping generator http://www.metastorage.net/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-objects/ <*> To unsubscribe from this group, send an email to: php-objects-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/