B4J Question [Solved] MySQL retrieve

Harris

Expert
Licensed User
Longtime User
I have a table...
It has many rows for columns VEH and Datetime (long).

How can I retrieve the latest UNIQUE VEH for Datetime - for all VEH?
I want a single record (from the many) which represents the last record where VEH (datetime) is greater than all other records in the set.

Select * from currposition where mydate <= datetime.now AND VEH UNIQUE ...

This should return a unique VEH (only one) with the last record entered into the table..

Thanks
 

Harris

Expert
Licensed User
Longtime User
I'm glad you caught that! That would be another subtle bug. That's what I get for going off the top of my head and using copy paste (thus propagating the error on and on). As to myself, no SQL expert here. I've just done enough headbanging with SQL that I know some of the pitfalls (but only some).
You know a heck more than I. I NEVER would have figured that out on my own... Spent ALL day yesterday trying. Simple when you look at it - hard to explain to others what the REAL issue is. Thanks for everyone's input.
That produces EXACTLY what I need, in it's basic form.
I shall have to limit the date range at some point AND restrict to a certain company ID (multi-tenant).

Now - add a timer, update the jar to my remote server and start throwing data at it from my Android devices and see how it responds...

Lookin good.
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
I also learned quite a lot with this topic, i am still falling in some pitfalls, but i really like to be SQL-ing, so it is a matter of time i hope.

thanks @OliverA
 
Upvote 0
Top