Skip to content

Tag: postgresql

Add on to an existing value in a field

In MySQL I would do something along the lines of I tried the following but after a bunch of searching I wasn’t able to find how to do the same in postgresql so my question is how would I go about adding a number to the previous value of a field (BIGINT) Answer You have to catch the value from

Date range to row in postgres

I have a table in postgres like this: id open_date close_date 5 2006-08-04 2019-12-31 There exist 4897 days between them. I need to turn the date range to date to have one record per day. For example: id open_date close_date valid_date 5 2006-08-04 2019-12-31 2006-08-04 5 2006-08-04 2019-12-31 2006-08-05 5 20…

PostgreSQL – how to have the 0 values using a WHERE?

i am currently working on PostgreSQL having 2 data tables : item and order. I want to display the number of order for each item in a period of time, but i would like to keep the name displayed if it’s 0. i’m actually doing: The problem is that my results are: And i would like to have: I have

Implement batchMerge() in JOOQ

I need to “upsert” a List of items. If an item’s id and anotherId is already existing, other values should be replaced by the new item. If it’s not, item should be inserted as new record. I came across JOOQ’s batchMerge and I thought it is similar to “upsert”. Unfortu…

Split text and digits by delimiter using regexp splitpart

From the table below I would like to split the config_json column into 2 columns as below The regex part of the code currently looks like this: However, there are some remains such as below: Thus, the formula above still needs to split by not just true,false or null, but also by digits or string. How can I fi…