create account

RE: Foooking can't grok GroupBy in Postgres by tierra-errante

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @penderis/foooking-can-t-grok-groupby

· @tierra-errante ·
$0.02
You don't use any ORM?
👍  ,
properties (23)
authortierra-errante
permlinkre-penderis-2024315t111938715z
categorypostgres
json_metadata{"type":"comment","tags":["postgres","coding","database","sql","webdevelopment","proofofbrain","hive-engine"],"app":"ecency/3.0.46-mobile","format":"markdown+html"}
created2024-03-15 15:19:39
last_update2024-03-15 15:19:39
depth1
children3
last_payout2024-03-22 15:19:39
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length22
author_reputation8,138,916,505,133
root_title"Foooking can't grok GroupBy in Postgres"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id132,074,171
net_rshares54,176,903,325
author_curate_reward""
vote details (2)
@penderis ·
$0.02
Yup, Eloquent from Laravel which I think is the part that kinda made me insist it can be done the way I want. Since there is the groupBy method for the ORM but also groupBy for result object. The groupBy on the result object does exactly what I showed and keys the results accordingly, where as the groupBy on the ORM or query builder is an interface for the SQL engines methods and in POSTGRES you have to have all columns from the select available in the groupBy + then any aggregates you use can be excluded so counting etc works but if I wanted all the data the best is to use the result and instead groupBy in my code to build the structure I want. 
👍  ,
properties (23)
authorpenderis
permlinkre-tierra-errante-2024315t1739161z
categorypostgres
json_metadata{"tags":["postgres","coding","database","sql","webdevelopment","proofofbrain","hive-engine"],"app":"ecency/3.1.0-vision","format":"markdown+html"}
created2024-03-15 15:39:21
last_update2024-03-15 15:39:21
depth2
children2
last_payout2024-03-22 15:39:21
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length654
author_reputation153,012,169,855,556
root_title"Foooking can't grok GroupBy in Postgres"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id132,074,546
net_rshares54,166,265,181
author_curate_reward""
vote details (2)
@tierra-errante ·
I think I understand, it just seems ugly to re-execute one query after another to recover the missing data
properties (22)
authortierra-errante
permlinkre-penderis-2024315t153247913z
categorypostgres
json_metadata{"tags":["postgres","coding","database","sql","webdevelopment","proofofbrain","hive-engine"],"app":"ecency/3.1.0-vision","format":"markdown+html"}
created2024-03-15 19:32:48
last_update2024-03-15 19:32:48
depth3
children1
last_payout2024-03-22 19:32:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length106
author_reputation8,138,916,505,133
root_title"Foooking can't grok GroupBy in Postgres"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id132,079,093
net_rshares0
@penderis ·
$0.03
Yes which is why I was pretty determined to get it in one go but for this case specifically I did not really need the extra data. If I did I think I would query the rows as normal and instead of having sql do the computing just run a loop to structure it as I want it , which is actually what I usually do. Guess it depends what I am querying, I will learn better ways to do it as I go I am sure :) !PIZZA
👍  ,
properties (23)
authorpenderis
permlinkre-tierra-errante-2024315t2224283z
categorypostgres
json_metadata{"tags":["postgres","coding","database","sql","webdevelopment","proofofbrain","hive-engine"],"app":"ecency/3.1.0-vision","format":"markdown+html"}
created2024-03-15 20:02:09
last_update2024-03-15 20:02:09
depth4
children0
last_payout2024-03-22 20:02:09
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.013 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length405
author_reputation153,012,169,855,556
root_title"Foooking can't grok GroupBy in Postgres"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id132,079,569
net_rshares55,221,402,272
author_curate_reward""
vote details (2)