Hi Backendless Team,
I have question regarding WHERE clause I am building.
Currently i load grouped table objects where i am looking for price item that has matching productId and storeId from lists
Is it possible to use CASE expression with codeless to cover case where i don’t have matching price from initial productId list and storeId list, and in that case I would use fallback storeId list.
From discussion with chatgpt it would look something like this:
WHERE
(productId IN ('productId1', 'productId2', 'productId3') AND storeId IN ('storeId1', 'storeId2', 'storeId3'))
OR
(productId IN ('productId1', 'productId2', 'productId3') AND storeId IN ('fallbackStoreId1', 'fallbackStoreId2'))
ORDER BY
CASE
WHEN storeId IN ('storeId1', 'storeId2', 'storeId3') THEN 1
ELSE 2
END
LIMIT 1
Goal is to get latest price from product/store combination, and if particular storeId does not have the price, would look up price in an alternative store list.