Questions tagged as 'postgresql'

1
answer

Problem in a simple Update with Inner Join

I'm running a simple update on my base, however the set I'm giving is being replicated to all rows in the table. Follow the script you ran: update reference_vendor set internalid = v.internal_id from reference_vendor rv inner join c...
asked by 06.08.2018 / 22:21
2
answers

SQL - How to Get Last Day of the Previous Month Dynamically in this Situation

Well, how do I get the last day of the previous month dynamically (associated with the current date); I have a column that is associated with the date in Milliseconds 'wo.CREATEDTIME' - Example of some dates in this format: > 152780...
asked by 11.07.2018 / 02:01
2
answers

How to change the last 100 records of the table in the PostgreSQL database?

I need to change a table field in my database to perform some tests, and would like to update only the last 100 records in the table. I already tried this code: UPDATE titulo SET autorizado='S' ORDER BY id_titulo DESC LIMIT 100; More this...
asked by 02.06.2016 / 14:56
1
answer

How to configure Postgres to accept date in PT-BR format?

Situation Let's say I have a form on which the user fills a date field, DD-MM-YYYY. Question How can I make postgres accept this format normally? No need to to_timestamp('14/06/2016', 'DD-MM-YYYY') Addendum SELECT...
asked by 14.06.2016 / 20:32
2
answers

Where in integer field [] Postgresql

I'm creating a select where I need to check on one of the columns that is of type integer [] if it has one of the values passed in the condition. For example: idTarefa | Setores 1 | {1,3,4} 2 | {2} Knowing that the Sectors...
asked by 28.07.2016 / 14:39
2
answers

How do I sum the difference of 2 intervals in Postgresql?

I need to make the sum of all the differences of the intervals that fulfill the condition of the where. There is only one, however, if there is no end_date on this line, I need to pick up the current schedule and do the calculation with the curr...
asked by 21.08.2014 / 20:19
3
answers

Is there a difference in performance depending on what you are looking for?

Is there a difference in performance when querying the database, depending on the number of characters entered in the query? For example, if a query is made for any record that has the 'a' character, will it spend more processing than searchi...
asked by 20.01.2017 / 00:26
2
answers

SQL to compare hours and minutes when Timestamp in PostgreSql

I am trying to compare 2 timestamp fields, which have different dates, ignoring the dates and using only the hour / minute simultaneously, to know, within one day which one is larger. EX: '2000-10-10 10:00:22' > '2000-02-02 11:00:10' In...
asked by 12.01.2017 / 00:24
1
answer

Sub select with COUNT and SUM

I have the following query : SELECT s1.suprimento, e1.numeroserie, s1.capacidade, e1.numeronotafiscal, e1.valorunitario, e1.datanotafiscal FROM public.estoque e1, public.suprimento s1, public.fornec...
asked by 19.03.2018 / 13:53
1
answer

Qt SQL - ERROR (42601): syntax error at or near

I'm currently developing a program to help manage a barracks in my city, I'm using Qt to create the graphical interface and other necessary libraries like database manipulation, for the server I'm using postgres , when trying to cre...
asked by 31.08.2018 / 13:44