I’ve a current table like this and would like to obtain this desired table: As you can see, this desired table should have a fourth column which indicates me the proportional value of the price in …
Tag: postgresql
Creating new category columns with corresponding values from a SELECT statement
I’m trying to create a SELECT statement where the values under “category” and “category2” column will become actual columns and show the corresponding “url” and “url2” under them. Basically I have …
Filtering out duplicates yet showing non-duplicate rows from another column in one row
I have a table with multiple duplicate values. What I’d like to do is use some sort of SELECT query that will filter the duplicates by name and yet keep all the appropriate values from the “expertise”…
duplicate elimination with time
For my Smart home Stuff I create a Database, but I make a mistake during programming: the application posting stuff into the Database twice. I want to delete all rows, which contain duplicates. With …
How to query: “for which do these values apply”?
I’m trying to match and align data, or resaid, count occurrences and then list for which values those occurrences occur. Or, in a question: “How many times does each ID value occur, and for what …
sql how to sort by a union’s subquery without adding a column?
So I mostly have the query I need, but I noticed that I still get duplicates from the first select and the second select. I thought that using UNION instead of UNION ALL would remove duplicates, but …
Postgres Function not working when I have a large result
I’m copying information from table 1(tmp_subtype) to table 2(subtype_user). I have a test table 1 with 15 registers. I run this function into postgres: CREATE OR REPLACE FUNCTION …
grouping rows while being able to show columns from each row in the group
I’m sure the title is not clear enough, couldn’t find a better way to explain what I need. I’m using PostGreSQL 11.4 i’ll minify the problem i’m having to show the actual issue. I have a query that …
Postgresql tuple constraints about NOT NULL
I am building a database in POSTGRESQL, and I would like to create NOT NULL constraints for my columns, where one and only one column would be NOT NULL. I have two columns in my table, site_id and …
How to get particular object from jsonb in PostgreSQL?
I have a table called ‘Test’ that holds two fields ‘qnId’ and ‘Answers’. ‘qnId’ stores a uuid and ‘Answers’ is a jsonb array that roughly looks like this: [{ “user” : “1”, “ans” : “some text” }, { “…