skip to Main Content

Postgresql – psql filter rows on an aggregate function

I have the following table: +------+-----------+-------------+--------------+ | year | team_name | player_name | total_points | +------+-----------+-------------+--------------+ | 1992 | Magic | Shaq | 2000 | +------+-----------+-------------+--------------+ | 1992 | Magic | Steve Kerr | 4000 | +------+-----------+-------------+--------------+ | 1996 |…

VIEW QUESTION

Postgresql – SQL: Select distinct items where condition is met

I have a relation in a database as follows: constituents Symbol [{"weight":0.5, "ticker":"WPM"},{"weight":0.5, "ticker":"AEM"}] GLD [{"weight":0.5, "ticker":"XYZ"},{"weight":0.5, "ticker":"ABC"}] KLE [{"weight":1.0, "ticker":"TSLA"}] TSLA [{"weight":1.0, "ticker":"MSFT"}] MSFT [{"weight":0.4, "ticker":"XYZ"},{"weight":0.6, "ticker":"ABC"}] KLE [{"weight":0.3, "ticker":"BBBY"},{"weight":0.7, "ticker":"GME"}] MEME I want to get the distinct symbols…

VIEW QUESTION

Postgresql – SQL Query be changed to go back 14 months but include whole month based on now?

SELECT t.cora_acct_code, t.accountnumber, c.accounttype, t.accountingdate, t.postingamount, t.refer_30, t.control_30, t.control2_30, t.detaildescription FROM ed.gljedetail_v as t LEFT JOIN ed.glcoa_v as c on t.cora_acct_code = c.cora_acct_code AND t.accountnumber = c.accountnumber WHERE t.cora_acct_code = 'BMW-A' AND t.accountingdate <= now() AND t.accountingdate >= now() -…

VIEW QUESTION

Extract substring from string in postgresql between an end delimiter and its previous motif

i'm really struggling on this one : I have some extradata in a postgresql db in which a number matters. Exemple: {"code_partenaire":"welcome","sous_statut_abc":"1","statut_alpha":"blabla"} {"code_partenaire":"code33","sous_statut_def":"1782","statut_alpha":"blablabla"} {"code_partenaire":"222","sous_statut_ghei":"17","statut_alpha":"blablaa"} I would like to extract the character between ","statut_alpha" and its previous ":" Because there is…

VIEW QUESTION

How to convert column values into rows PostgreSQL

This is my query: SELECT * FROM profile_change_set where id = '1558079b-d954-4a0d-b241-b39fe8f3498c'; id table_name column_key column_value operation_type 1558079b-d954-4a0d-b241-b39fe8f3498c farmers smsEnabled somvalue update What is want is to convert all values into rows. column_key column_value id 1558079b-d954-4a0d-b241-b39fe8f3498c table_name farmers column_key smsEnabled…

VIEW QUESTION
Back To Top
Search