Questions tagged as 'postgresql'

2
answers

Transpose a result from one column to another in Postgres

I have a table similar to the following: (only an example to narrow the problem) I need to get to this result in which in the current column for the C concept I have the result of the negative B concept from the previous column. Sup...
asked by 21.12.2017 / 19:32
3
answers

How to group this type of query?

I have problems with formulating the query to resolve the following. I have a table like for example (illustration). I need to group by the trio of columns that appear in yellow and the fourth column of the result of the query would be the rec...
asked by 14.10.2016 / 18:24
1
answer

Query pulls an error by ambiguous column

Good morning I'm making a query in postgress and it throws an error:    "ERROR: the reference to the column" num_request "is ambiguous LINE   4: WHERE num_request in (3,6,9); ", select * from area inner join empleado on area.num_solicitud...
asked by 04.01.2019 / 14:38
1
answer

What differences exist between the different ways of defining a DEFAULT 0?

I have the following query: ALTER TABLE compras.factura_gasto ADD COLUMN m_excento numeric(36,2); ALTER TABLE compras.factura_gasto ALTER COLUMN m_excento SET DEFAULT 0::numeric; My question is: In SET DEFAULT Is there any difference betwee...
asked by 09.10.2018 / 06:38
1
answer

How do I consult in a table from a column "json" the rows that contain only one data in that column?

I have a table as follows: CREATE TABLE partes( id INTEGER PRIMARY KEY, id_padre INTEGER, tipos JSON ); I insert the sample data: INSERT INTO partes (id, id_padre, tipos) VALUES (1, 0, '["1","2"]'), (2, 1, '["2"]'), (3, 1, '["2","1"]...
asked by 13.07.2017 / 20:35
2
answers

Group by a field and see all the values of each record - SQL

I need to group by date a table with several dates with a specific value for each date. For example: 01/01/2016 10 01/01/2016 20 01/01/2016 30 02/01/2016 40 02/01/2016 50 ... The result should be: 01/01/2016 10 20 30 02/01/2016 40 50 T...
asked by 09.01.2017 / 20:15
2
answers

Error reading an .sql file

Good evening Community. I have a program in java, which I pass as an argument the authors.sql file (database in postgresql) which contains a single line: INSERT INTO authors VALUES ('CEVA', 'K.', 'Cherteston') At the moment of reading th...
asked by 29.10.2016 / 01:52
1
answer

PostgreSQL external db in Django

I have a Django project and I use a postgresql database in local and it goes perfectly with the module psycopg2, now, I put an external database and when I do a migrate it gives the following error. django.db.utils.OperationalError: FATAL: no...
asked by 10.05.2016 / 13:47
1
answer

Visual Studio Installer Projects with PostgreSQL

I am starting a Windows Form C # project, a commercial application that the user downloads, installs and uses, without complications. Is it possible to configure Visual Studio Installer Projects to install together PostgreSQL without the user no...
asked by 10.08.2017 / 05:47
2
answers

Synchronize data between two databases with the same structure

I need to pass the data from one database to another with the same structure, the problem is that both databases are in use, in both you can insert different records and they are in different places. For example: in DB1 we enter an invoice fr...
asked by 26.05.2016 / 16:47