• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Delete records 3 id's of my last record with some name and mac

 
alex friday
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a table "behaviour" as below and I want to achieve the following when the next stop name is differance of the last one in the table. I want to maintaine the records of the prvious stop name before inserting the new one in the case the stop's name are different.
I want to pick the records with the min distance, min speed and max speed of the previous stop name and inserting them (these 3 records) to my table after that I want to delete all records 3 id above the 3 new insetred one with some stop nam and mac . The name and mac might be anyone.

I just need some help in the mysql query how to maintain the records of the previous one after inserting the 3 records(min distance, min speed and max speed)?

I appreciate any help.

 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are min_distance, min_speed and max_speed not saved in the same record?

So after you have inserted 3 records (with min_distance, min_speed and max_speed) you want to delete the previous inserted records with the same stop_name and mac. Is this what you want to achieve? Or did I misunderstood something?
 
alex friday
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The 3 values are being calculate after comparing of the data of the multiple requests in the table. Therefore I have created the behaviour table.

I have achieved what I wanted by storing the result of the 3 quieries in custom ArrayList and then after delelting the records I have inserted the optimal 3 one.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic