I'm using dbForge mySQL version 5.7. I have the following query:
SELECT product, location, last_updated
FROM (
    SELECT 
        product, 
        location, 
        last_updated,
        RANK() OVER (PARTITION BY product ORDER BY last_updated DESC) as rn
    FROM warehouse
)temp
WHERE temp.rn = 1;
I'm trying to get the last location of a product in the warehouse; a product can have many different locations at different times. I keep getting a syntax error, but I do not see what I'm doing wrong. Any thoughts?
 
    