Is there a way in POSTGRESQL to limit a resulting query given a condition?
I have tried something like this:
SELECT *
FROM table
LIMIT CASE
WHEN extract(hour from now())=9 then 143
WHEN extract(hour from now())=10 then 178 ETC.`
I need to use this because depending on the current hour and the hour in the table, dinamically limit with the condition.
Any thoughts or ideas?
LIMIT CASE WHEN extract(hour from now())=11 and replace(to_char(now(),'day'),' ','')='thursday' then 109 end