The code given to query all data in the mobile inventory tutorial is giving me an error :
Relation "items" does not exist
for the sample code given in the documentation below. I can see that it says
from items and that it relates to nothing - but can someone help me understand how I can fix this error? What was the intent of the Retool code to include this?
-- sub-query to selects the data to use
with "itemsWithWH" as (
select
items.id,
items.title,
items."reviewsCount",
items."thumbnailImage",
items."price/value",
items."price/currency",
items."brand",
items."url",
items."returnPolicy",
items."features/0",
items."features/1",
items."features/2",
items."features/3",
array_agg(distinct wh."warehouseId") as warehouses
from items
join "warehouseitems" as wh
on wh."itemId" = items.id
group by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 , 11, 12
)
select * from "itemsWithWH"
where
title ilike {{ '%' + (Products_SearchInput.value || Filters_ProductSearchInput.value) + '%' }}
and ({{ !Filters_BrandSelect.value }}
or brand = {{ Filters_BrandSelect.value }})
and ({{ !Filters_WarehouseSelect.value }}
or {{ Filters_WarehouseSelect.value || 0 }} = any(warehouses))
and ({{ !Products_Scanner.data }} or id = {{ Products_Scanner.data ? Products_Scanner.data[0] : 0 }})
order by "reviewsCount" desc