JSFiddle - React, Tailwind, and code Playground

by Antony Joyson

HTML

<!-- sub query to order the group by functionality -->
select re.id as re_id , p.*, pa.lat as latitude,pa.lang as longitude,pa.address,pa.zip as post_code, pa.city as city_name, pa.state as statename,(select count(id) from fc_review where product_id=p.id) as reviewcount, pp.product_image from fc_product p JOIN fc_rentalsenquiry re on re.prd_id=p.id and re.booking_status='Booked' LEFT JOIN fc_product_address_new pa on pa.productId=p.id LEFT JOIN fc_rental_photos pp on pp.product_id=p.id 
where re.id in (select max(id) from fc_rentalsenquiry group by prd_id) group by re.prd_id