• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic