I have two sql query:
1)
SELECT DISTINCT item_id
FROM sh_itemviews WHERE login='".$login."'
ORDER by time DESC LIMIT 5"
2)
SELECT *
FROM sh_item WHERE id=itemIdFrom sh_itemviews "
So i want to do it better and i'm trying to use LEFT JOIN:
SELECT DISTINCT *
FROM sh_itemviews
LEFT JOIN sh_item ON sh_item.id = sh_itemviews.item_id;
WHERE sh_itemviews.login='".$login."'
ORDER by sh_itemviews.time DESC LIMIT 5"
Like a result i have all data where sh_item.id = sh_itemviews.item_id; but other constructin WHERE is ignored. What i'm doing wrong? Thanks!