Skip to content
Advertisement

MYSQL – max(id) pulling correct id but incorrect related data [closed]

I’m trying to get the latest data from a table based on a join. I’m having trouble getting it to return anything but the first record, (old data). The temp_table would just have a listing of workstation names and I need to join it to the workstation data table but only grab the latest data.

My data may consist of :

And my query is:

My results are :

How can I get it to return the corresponding data from row 2 rather than the id from 2 and data from one?

I’ve also tried this:

But it doesn’t know what the a.name is referring to in the “name = a.name” join condition.

Any help is greatly appreciated.

Advertisement

Answer

Never mind, the e.status and e.sched shoudld be f.status and f.sched. Wasn’t thinking completely. Thanks for consideration regardless.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement