开发者

Stored Procedure in postgresql, multiple queries w/ aggregates

开发者 https://www.devze.com 2022-12-29 21:17 出处:网络
I\'m trying to write a store procedure that can take some input parameters (obviously开发者_JS百科), run multiple queries against those, taking the output from those and doing calculations, and from t

I'm trying to write a store procedure that can take some input parameters (obviously开发者_JS百科), run multiple queries against those, taking the output from those and doing calculations, and from those calculations and the original queries, outputting a formatted text string like:

Number of Rows for max(Z) matching condition x and y of total rows matching x (x&y/x*100).

To explain the max(Z) bit, this will be the username field, it won't matter which actual entry is picked, because the where clause will filter the results by user id, is there a saner way to do this?


For starters break the code up into multiple procedures. Don't create one procedure that does all of these things.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号