I am having difficulty to understand what I would like to achieve :S - sorry about my English
I have a product table with a location history ID I have a history table with a location ID and last transferred date I have a location table with the location names
Tables:
**site_product**
product_id
product_name
**site_trans**
trans_id
trans_product - link the product
trans_inventory - for the location
trans_date2 - date when it was assigned
**site_location**
location_id
location_name
I use PHP to build an table to gather all the info together it is working and I have all columns sorted a part of the location.
Here is my working version BUT without the location names... (if that helps)
SELECT * FROM site_trans WHERE trans_product=product_id (e.g. 659) ORDER BY trans_date2 DESC Limit 1
It gives the location ID number but I would like to go further and get the location name see above. If there is one it does nothing so leaves.
Question:
how to link the location to this to make it work? Please.
Could someone to light the way how I could do a Select if within please?
(I am a beginner in many ways so even a lecture would be appreciated to start with)
UPDATE1: LIMIT 1 is designed for the last location