I have a column in my database that saved with double quotation (“) now I want to replace it by space.I’m using REPLACE and whereRaw.but It dosent work. this is my code: actually using / for scaping (“).Any Idea? Answer I believe you found the answer in the comments another thing what I suggest is don’t append the value directly
Tag: where-clause
Postgres get all elements where value matches from jsonb array
I think I am trying something simple, but after hours I just can’t get it to work. I have a table which contains a tags column, which is a jsonb array and looks like this: I now want to write a query which returns the full object to me, when the name matches the search string. So far I came
Get previous months first and last date
I need to query last month data from a database. So I need the first and last date of previous month to be able to make the “between” SQL query. First date starts always from 1 of course, …
Postgres comparing strings from json and table
I have the following postgres stored function: CREATE OR REPLACE FUNCTION wg.get_user( req jsonb) RETURNS jsonb LANGUAGE ‘plpgsql’ COST 100 VOLATILE AS $BODY$ DECLARE …
SQLite: How to see people that aren’t my friend, but are friends with my friends
I have a database in DB Browser where I have two tables; So my question is, how do I make a query that Displays People that I’m not friends with, but my friends are friends with them. It’s so I can find new friends basically. Answer You can join multiple times:
Use rownum to indicate what rows I have pulled back
I have table of people, with firstname and lastname. firstname lastname a a b b c c d d e e f f g g h h i i j j I want to query from a specific point. For example. SELECT FIRSTNAME, …
Select only newer records among the result of a query that extracts duplicate rows in a db
I have a db where I can have multiple rows with same field “aid” (it’s a sort of historical changelog of same items). With the following query, I’m extracting rows with same aid orderd by descending date: That should be a child table related to a father layer (made by a postgres materialized view that shows only newest aid records)
postgresql jsonb case insensitive query with index
I was looking for a way to make a case insensitive query, and I found it here (postgresql jsonb case insensitive query), more precisely with a query like this : select … where upper(data::text)::jsonb @> upper(‘[{“city”:”New York”}]’)::jsonb However, I can’t seem to find enough information about how to create an index to be used by such a query. works perfectly
Why I get division by zero for PostgreSQL v13? I suppose rows should be filtered out
Running same query on different versions of PostgreSQL gives different result. WITH t(a, b) AS (VALUES (1, 0)) SELECT a / b FROM t WHERE b 0; On v11.10 I get no rows as expected fiddle On …
How to have different values of a single column in a condition where in sql?
I write a SQL query to get different sales information about stores. The problem is that I would like to filter and take only some store numbers in my “GL_ETABLISSEMENT” column, if I just do …