If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Deleting records depending on criteria. Harder than it sounds.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-11-11, 13:52
Directlinq Directlinq is offline
Registered User
 
Join Date: Oct 2009
Posts: 2
Deleting records depending on criteria. Harder than it sounds.

Help im really struggling.*
I have hit a brick wall in my php mysql project, i hope somebody can help me.*

I have a mysql table, here is a sample*

id DATE TIME BRTOTAL BRNO LENDER LONO LOTOTAL*
54 10/09/2011 14:09 - - >>4.7% 40 £12k*
55 10/09/2011 14:09 - - 4.6% 31 £6k*
.56 10/09/2011 14:09 - - 4.5% 106 £32k.*
.57 10/09/2011 14:09 - - 4.4% 14 £15k.*
59 11/09/2011 14:09 - - >>4.7% 40 £12k*
60 11/09/2011 14:09 - - 4.6% 31 £6k*
.61 11/09/2011 14:09 - - 4.5% 106 £32k.*
.62 11/09/2011 14:09 - - 4.4% 14 £15k.*
64 11/09/2011 15:09 - - >>4.7% 40 £12k*
65 11/09/2011 15:09 - - 4.6% 31 £6k*
.66 11/09/2011 15:09 - - 4.5% 106 £32k.*
.67 11/09/2011 15:09 - - 4.4% 13 £13k.*


Sorry if the layout has gone sqew but you get the idea.*
I really need to build a query that will do the following.
If there is more than 2 records with the same date and time, delete the records with the same date and time except for 2 with the highest id*
I have put .'s by the records that should be left, once the code has been run.*

Could somebody help me try and put this into php script to delete records from mysql table.*

Many Many Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On