3 ms·
> Can you model this in EdgeQL? Absolutely! WITH april := <datetime>'2020-04-01T00:00+00', NewCustomers := ( SELECT Customer FILTER
by RedCrowbar 6y ago
> Can you model this in EdgeQL?
Absolutely!
WITH
april := <datetime>'2020-04-01T00:00+00',
NewCustomers := (
SELECT Customer
FILTER
NOT EXISTS (
SELECT .orders
FILTER .date < april
)
),
AprilCustomers := (
SELECT Customer
FILTER
datetime_truncate(.orders.date, 'months') = april
),
NewAprilCustomers := (
SELECT AprilCustomers
FILTER AprilCustomers IN NewCustomers
)
SELECT
(count(NewAprilCustomers) / count(AprilCustomers)) * 100;
This assumes the following schema:
type Order_ {
property date -> datetime;
}
type Customer {
multi link orders -> Order_;
}
- querylangs2020 6y agoThanks. I'm going to dig in a bit more. I've been sold by the above and the homepage.. :)