I\'ve got two tables. Table \"B\" has a one to many relationship with Table \"A\", which means that there will be many records in table \"B\" for one record in table \"A\".<
This will fetch the latest record with JOIN. I think this will help someone
SELECT cmp.*, lr_entry.lr_no FROM (SELECT * FROM lr_entry ORDER BY id DESC LIMIT 1) lr_entry JOIN companies as cmp ON cmp.id = lr_entry.company_id