Put in in a query scope:
Apr 25, 2022
4
Level 1
Run a different query if column value equals something else
I was wondering if there was a way to do this. For example, I have a properties table with a price and rental_frequency column. The rental_frequency column's values can either be daily, weekly, monthly or yearly. Would it be possible to do a different query on each row depending on their rental_frenquency value? Something like this maybe:
- If rental_frequency is daily then retrieve the rows with the price around 2000
- AND If rental_frequency is monthly then retrieve the rows with the price around 20000
- AND If rental_frequency is yearly then retrieve the rows with the price around 2000000
I understand this can be achieved by mapping the collection but I wanted to do it from the query level so as not to slow down the program. Thanks.
Please or to participate in this conversation.