• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Ranch Hand
Posts: 59
  • 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.

 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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 Ardoin
Ranch Hand
Posts: 59
  • 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.
 
Be reasonable. You can't destroy everything. Where would you sit? How would you read a tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic