Skip to content

How to escape slashes in LIKE clause

I need to do some clean-up in a database and change some urls from http://www.domain1.com to http://www.domain2.com, so I am doing a query like this: UPDATE mytable set url = REPLACE(url, ‘”http:/…

Join SQL without Unique Identifier

I have two tables: Table A: EmployeeID DailyHour Date ID001 2 2021-02-01 ID001 4 2021-02-03 ID001 4 2021-02-04 ID001 4 2021-02-10 ID001 8 2021-02-15 ID002 8 2021-02-20 Table B: EmployeeID …

Calculate average days between two dates

I have the following table: Team PhoneNumber OrderNo CallDate OrderDate TM1 2222222222 26699443 2021-01-28 2021-02-05 TM1 1111111111 26699450 2021-01-22 2021-01-22 TM2 5555555555 26699466 2021-02-…

Join table with mapping of array in postgres

I want to join two table, with first table contain an array which is primary keys of second table in JSON format Answer demo:db<>fiddle You can use the ANY function: Edit: demo:db<>fiddle If you have jsonb arrays, you can use the @> operator. Note, that this works only if your integer id values…