Following are the two tables i have:
i need to write a mysql statement that will do followings:
- list the latest updated record of each company i.e. single record per company
- it should only list todays/current date record
interms of sorting:
- highest stock value with latest updated should be displayed on top.
- if both company has same stock value then the one who updated first should go on top. (i.e. latest updated should be on second)
i did something like this but it displays multiple records for each company:
i will be grateful if someone can help me please.
SELECT * from tblcompany, tblstock
WHERE tblcompany.comid = tblstock.comid
AND tblstock.updated >= CURRENT_DATE()
ORDER BY tblstock.stock DESC, tblstock.updated ASC