I have a table structure like the following
idx   p_id    location_id  
1     CTX      A1
2     CTX      A2
3     ABC      A3
4     ABC      A1
idx is auto increment number and indicating the latest location (for product CTX case, it transfered from A1 to A2)
NOW, what I want to find is any product in location A1. I should find only product ABC, since product CTX moved from A1 to A2, it no longer in the A1
Is there easy way to perform with SQL query?
 
     
     
     
    