How to reduce result rows of SQL query equally in full range?
问题 I have values related to dates. I need to select data for example for 10 years. Standard query result has approximately 3000 rows, but I need to show them on graph with 400px width and send them over the rest api to mobile phone. So it would be nice to reduce the data to let's say 400 values. Is there any build in method how to reduce data equally in full range in SQL Server or PostgreSQL? How should I do this? 回答1: In Postgres , width_bucket() is just the thing you are looking for - to