how to use correctly if statement postgresql
问题 I'm trying to create a trigger that populates a table everytime X amount of rows are added to other table. The logic would be: 1- check how many rows are in table A based on last date on table B. 2- once there are 1000 rows in table A from the last date on table B, add one row to table B Table A stores ticks from market and table B stores OHLC data (Open, High, Low, Close). Ticks have only 3 columns: date, bid and ask. Open is the first known price, Low is the min price, High is the max price