I am trying to create a computed postgres field to display the daily order number, that should start at 1 at each new date.
I am struggling with the where logic, here is where I am now:
```sql
CREATE OR REPLACE FUNCTION fn_daily_order_no(order_row orders)
RETURNS text
AS $function$
SELECT count(id)
FROM orders
WHERE date_created -- >= date_created date:00:00 (beginning of the day) AND date_created <= order_row.date_created
$function$
LANGUAGE plpgsql
```
Any ideas?