WSAK3COFTCT3VMN7UKLQNE46ACT66QYWV2LWCKSII3OFTUTUEJHAC
type,--think about what order bys will make separating by concentration by important. obvious ones are sort by thc / cbd. 2.5mg argyle on top, 10mg argyle on bottom. in all other cases, 2.5mg and 10mg argyle should be one product and not duplicated. price maybe. producer / brand / name definitely not. what wheres will show both? if both are shown, does order matter? before implementing stackoverflow.com/q/28560389 stackoverflow.com/q/10614505 "gaps and islands". more efficient to group by once compared to group by => (row_number or lag + sum) + group by
type,
) as $$--this is different. input should be variant(10mg, 2.5mg). its product_id should be excluded from result set incase another variant is "similar". but also, group by product id. don't show the same different gummy twice for example because two different concentration per pack. this is also a problem with get_products. if both different concentrations are recommended to the user, should be just one. only if filters showing only one of the concentrations at a time is ok. concrete example. if only 2.5mg is safe, product card link => 2.5mg highlight. same with 10. but if both are safe, don't show up as two cards. does group by change the order? how can I group by only if beside each other??
) as $$
@ avg_range(thc) / ((min_portions + max_portions) / 2) - (select avg_range / first from p) asc nulls last
least(@ avg_range(thc) / min_portions - (select avg_range / first from p), @ avg_range(thc) / max_portions - (select avg_range / first from p)) asc nulls last