skip to Main Content

How to Join 2 table with json key in Postgres? – Postgresql

I have 2 table CREATE TABLE json_data_table(d_id int, d1_json json, d2_json json); CREATE TABLE user_data(uid int, username varchar); and data respectively are INSERT INTO user_data VALUES (1,'test_user_1'), (2,'test_user_2'), (3,'test_user_3'); INSERT INTO json_data_table VALUES (1,'{"stage1":1,"stage2":2 }', '{ "stage1": { "date": "12-01-2023",…

VIEW QUESTION

Mysql multiple tables update – results inconsistent

UPDATE table1 alias1,table2 alias2 SET alias2.CURRENT_CD_BALANCE = alias2.CURRENT_CD_BALANCE - alias1.ORIGINAL_AMOUNT , alias1.COMMENT = concat('Sum of ',alias1.ORIGINAL_AMOUNT,' Cancelled') , alias1.BALANCE = 0, alias1.ORIGINAL_AMOUNT = 0, TRAN_TYPE = 'D' WHERE alias1.STORE_ID = alias2.STORE_ID AND alias1.ACCTNO = alias2.ACCTNO AND alias1.AR_TRANS_ID = value1; Query…

VIEW QUESTION

Delete duplicates with condition – Mysql

I have the table contacts which contains duplicate records: id name is_contacted created_at I need to delete duplicates, but keep the first record(among the duplicates for each name) where is_contacted=1. If among the record duplicates there are no records where…

VIEW QUESTION
Back To Top
Search