unable to add limit to the subquery
select   i.id, 
         i.name, 
         i.description, 
         s.quantity stock,
         (select purchaseRate
          from itemPurchaseDetail
          where item_id = i.id
          order by PurchaseDate desc
          limit 1) lastPurchaseRate 
from     item i
join     (select distinct item_id, branch_id
          from itemPurchaseDetail) pd
on       pd.item_id = i.id
join     stock s
on       s.item_id = i.id
and      s.branch_id = pd.branch_id;


id | name  | description | stock | lastPurchaseRate
-: | :---- | :---------- | ----: | ---------------:
 1 | item1 | desc 1      |   100 |              222
 2 | item2 | desc 2      |   200 |              444
 3 | item3 | desc 3      |   300 |              666


dbfiddle here