I have two tables, one of the holds tools, the other one holds the tools history like location and who has it. I need to run a search question on this tables and have tried this
SELECT tblmaskin.*
FROM `tblmaskin`
INNER JOIN tblmaskinhistorik ON tblmaskin.maskinId=tblmaskinhistorik.maskinId
WHERE tblmaskin.maskin='".$_POST['sok']."'
OR tblmaskinhistorik.var='".$_POST['sok']."'
OR tblmaskinhistorik.anvandarnamn='".$_POST['sok']."'
But the problem is that I only want to search the last inserted row for that tool in the history table. When you do a search for a tool by place for example you only want to get the tool that is there now.
Is there a way to do that?