Posts by R.Santos • 2,251 points
201 posts
-
0
votes0
answers119
viewsQ: Add counter - Postgresql
I have the following Query: SELECT array_to_string(array_agg('"'||public.lotesretornosuprimento.codigoestoque||'"'), ', ') as codigos, est.codigosuprimento, public.suprimento.suprimento, ( select…
-
6
votes3
answers475
views -
2
votes1
answer38
viewsQ: List contents of a list with a method
I have the following code: using System; using System.Collections.Generic; public class Program { class Candidato { public int numeroPartido {get;set;} public string nomeCandidato {get;set;} public…
-
1
votes1
answer98
viewsQ: Group_concat in JPQL
I created the following`query: SELECT o.codigoChamado, o.codigoOrcamento, group_concat(o.conteudoOrcamento), o.observacaoOrcamento FROM Orcamentos as o group by o.codigoChamado, o.codigoOrcamento,…
-
1
votes0
answers1385
viewsQ: Turn rows into columns - Postgresql
I have the following Query: SELECT public.tipocontratoempresa.codigoempresa, CAST ((public.tipocontratoempresa.quantidadehorasmensais * 3) AS Integer) as horastrimestrais,…
postgresqlasked R.Santos 2,251 -
1
votes1
answer186
viewsQ: Error while trying to perform postgresql database backup
I am trying to perform a backup of a database in Postgresql, however I am getting the following error: erro ao ler objeto grande 118287: ERROR: permission denied for large object 118287 I searched…
-
1
votes0
answers16
viewsQ: Rounding of decimal places
I hold the following value: 6.175 When I use the .toFixed(2) that number the correct value that should be returned is 6.18, right? Rounding But I’m getting 6.17 as a return. There is another way to…
javascriptasked R.Santos 2,251 -
1
votes1
answer91
viewsQ: Sum return of select
I have the following query: SELECT (case when day(sysdate()) < 10 and meses.mes = month(sysdate()) then 0 else CAST(SUM(CASE WHEN s2.name LIKE '%Servidores' THEN ( coalesce(ta.time_unit,0) *…
-
2
votes2
answers2740
viewsQ: Select the first and last day of the previous month
I have the following query: select ADDDATE(LAST_DAY(SUBDATE(CURDATE(), INTERVAL 1 MONTH)), 1) primeiro_dia, last_day(sysdate()) ultimo_dia That returns me the first and last day of the current month…
-
5
votes1
answer246
viewsQ: Error while running main report - Jasper Studio
I am generating a report in Jasper Studio, where the main report has N sub reports, one of which has a connection to a database other than the main report. When I run the main report in Jasper…
-
4
votes4
answers327
viewsQ: Return results for all months of the interval
I own the following query: SELECT CAST(SUM(CASE WHEN s2.name LIKE '%Servidores' THEN (ta2.time_unit * 1.5)/60 ELSE ta2.time_unit/60 END) as DECIMAL(12,2)) AS TEMPO_CORRETO,…
-
0
votes1
answer43
viewsQ: Query Mysql returning differently
I have the following Query: select MONTHNAME(ta2.change_time) as mes, MONTH(ta2.change_time) as numeroMes, case when s2.name like '%Servidores' then cast(SUM(ta2.time_unit) as UNSIGNED) * 1.5 else…
-
2
votes1
answer251
viewsQ: 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,…
-
0
votes1
answer34
viewsQ: Select number of returned lines
Is it possible to select the number of rows returned in a select? For example: In that case it would have to be returned 12.…
postgresqlasked R.Santos 2,251 -
1
votes1
answer42
viewsQ: Create a column for each row returned from Select
Yesterday I posted a question regarding how to return something even if there are no records found, and with the help of @Rovannlinhalis we managed to get the following query: with dados as ( SELECT…
postgresqlasked R.Santos 2,251 -
3
votes2
answers549
viewsQ: Return default value if no record
I have the following sql command of select: SELECT public.controleimpressoes.codigo, public.impressoras.patrimonio, public.impressoramodelo.modelo, public.impressoralocal.descricao, (select…
postgresqlasked R.Santos 2,251 -
0
votes2
answers359
viewsQ: Check interval between two dates
I need to check if the interval between two dates does not exceed 12 months, for this I did the following in javascript: var dataFinal = new Date(); var dataInicial = new Date();…
javascriptasked R.Santos 2,251 -
-2
votes1
answer84
viewsQ: Using LIKE together with BETWEEN
You can select data with the between along with the like, for example: public.retornotoner.observacao like between 'A%' and 'Z%' Or is there something that might be similar to that? Data example:…
postgresqlasked R.Santos 2,251 -
4
votes3
answers3856
viewsQ: Return month name as select
I need to return the name of the month with the command select, I know with command Select extract('Month',data) He returns me the number of the month in question, there is a way to bring the number…
postgresqlasked R.Santos 2,251 -
1
votes1
answer29
viewsQ: Select data even if it is not in all tables
I have the following Query: SELECT public.suprimento.suprimento, public.estoque.numeroserie, public.fornecedor.nome as fornecedor, public.estoque.data as dataentrada,…
postgresqlasked R.Santos 2,251 -
2
votes1
answer43
viewsQ: Select only the days of a Timestamp
I need to select only the days of a date subtraction, and if possible convert this number to Integer, is this possible? SELECT (select count(numeroserie) as porcentagemTotal from…
postgresqlasked R.Santos 2,251 -
1
votes1
answer304
viewsQ: Place columns only in the Detail field in Jasperstudio
I have a report created in Jasperstudio, I need to put only columns in the Detail field, but when I configure to have two columns the report fields also end up configuring with two columns: Model…
-
1
votes1
answer3125
viewsQ: Restore from only one table - Postgresql
How can I re-store only one table from one bank to another? I created the table backup from the following command in CMD: pg_dump -f C:\Backup\Backup_table.backup -t public.lotesretornosuprimento -d…
postgresqlasked R.Santos 2,251 -
0
votes2
answers6651
viewsQ: Select higher value from the latest date
I have a table estoque where records of all supplies are stored, with the date of entry into stock, the supply code and the unit value of the piece, my need would be to take the highest unit value…
-
1
votes2
answers55
viewsA: Select with wrong result
I solved my problem by performing a subSelect: SELECT public.estoque.codigosuprimento as cod ,suprimento, public.tiposuprimento.descricao, capacidade, count(public.estoque.codigosuprimento)…
postgresqlanswered R.Santos 2,251 -
0
votes2
answers55
viewsQ: Select with wrong result
I have the following select: SELECT suprimento, public.tiposuprimento.descricao, capacidade, count(public.estoque.codigosuprimento) quantidade,estoqueminimo, sum (valorunitario) valor FROM…
postgresqlasked R.Santos 2,251 -
1
votes1
answer96
viewsQ: Random character insert - Postgresql
I have a Function that makes an Insert when a certain action occurs, I’m trying to insert together random letters but I’m not finding anything related to this, It is possible to do this in…
-
4
votes2
answers14478
viewsQ: HTML code in the body of the e-mail
I created an HTML code to send information to the company’s clients where I work, when I send the email to the accounts *@hotmail.com or for their professional accounts *empresa.com.br everything is…
-
1
votes1
answer47
viewsQ: Convert Wrong sequence string to display
I own a string in the following format 2017-12-08, but need to display it formatted for the user as follows: 08/12/2017, I thought I’d use the SimpleDateFormat but for this I need the variable to be…
-
0
votes1
answer129
viewsQ: Report on Jasperstudio with subReports
I need to create a report with two Querys distinct in the JasperStudio, for this I researched and saw that the best way to do this would be via sub reports but even doing exactly the same as some…
-
3
votes4
answers2533
viewsA: How to split a string every 2 characters?
Another way would be to use a while: String text = "99E65A78" List<String> stringSerparada = new ArrayList<String>(); int index = 0; while (index < text.length()) {…
-
2
votes2
answers377
viewsA: Transform String into Array - Groovy
With the help of @Lucashenrique I was able to solve my problem of converting a string into an array and be able to add something in subArrays, my final code was like this: def numEstoqueManual =…
-
2
votes2
answers377
viewsQ: Transform String into Array - Groovy
I own a String as follows: [["155","123RET"],["156","124RET"]] In other words, in it two subArrays that I need to add an item still in each one, my need is that in the end these arrays stay as…
-
4
votes3
answers120
viewsA: Convert String to Date and remove 1 day from String
$data = '26/11/2017'; $data = DateTime::createFromFormat('d/m/Y', $data); $data->sub(new DateInterval('P1D')); // -1 dia echo $data->format('d/m/Y'); I used the sub to remove the amount of…
-
2
votes3
answers1115
viewsA: Filtar Birthday of the day
Another option would be the following: SELECT data FROM public.estoque where extract (month from data) = extract (month from CURRENT_DATE) and extract (day from data) = extract (day from…
-
0
votes2
answers2352
viewsA: Reset datetime time with SQL
Another option would be like this: SELECT to_char(DATA, 'yyyy-MM-dd 00:00:00.000') AS DATE from TBL_DATAS;
-
1
votes2
answers81
viewsA: How to get the value of one table depending on the maximum value of another?
SELECT O.nome, SUM(E.saude) as valorSaude FROM Objecto O, Elemento E, composto C WHERE O.marca = C.prodMarca AND C.produto = O.codigo AND C.elemento = E.codigo GROUP BY O.nome order by valorSaude…
-
0
votes1
answer387
viewsA: How to make more than one select in the field for Jaspersoft
After suggestion of subselect the query was like this: SELECT pedidos_id , orders.cliente_id , orders.product_id , clients.name AS customer name products.name AS product name , Preco as…
-
3
votes3
answers1372
viewsQ: Transforming String into an Array - Javascript
With that return I’m getting the following string: return $data.requestSuprimentos.value; String [[1, X340H22G, 30000, 3], [2, 64418XL, 32000, 1], [3, X644X11L, 32000, 1], [4, 64018HL, 21000, 1],…
-
1
votes3
answers142
viewsA: Help with java arrays
Try this: if (!atual.contains(disciplina[j])){ atual.add(disciplina[j]) } So in case the array atual does not contain the content of discplina[j] he will add…
-
1
votes0
answers306
viewsQ: Set file cell *.CSV as merged
Is it possible for a given cell to be merged into a generated *.csv file? I ask because I am generating a *.csv file where the user should only do one Ctrl + C \ Ctrl + v in the content and paste in…
-
1
votes3
answers8105
viewsQ: LIKE and IN command in the same SQL command
It is possible to use like and in in the same SQL command? For example, I need to search in the table stockpile the Serial Number that can be 'SCAB171293E29','SCAB171293E4E' but they might have…
-
3
votes4
answers3710
viewsA: Doubt with month and year extraction in Postgresql date
Try it like this: SELECT extract(year from D.dt_ficha) || '' || extract(month from D.dt_ficha) from D Where D would be your table; For me it worked properly.…
-
1
votes2
answers475
viewsA: Select to Schedule in Mysql Meeting Room
We have come to the conclusion that to do the following query would solve the need: SELECT * FROM salas_reuniao WHERE meeting_room = '$salaReuniao' AND hour_start <= '$inicioReuniao' AND hour_end…
-
0
votes1
answer67
viewsA: Code in infinite loop
I solved my question as follows: import java.nio.charset.StandardCharsets; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.logging.Logger; Logger logger=…
-
3
votes1
answer954
viewsA: Archive *.CSV with UTF-8
I managed to solve my problem by changing the following line: BufferedWriter strW = new BufferedWriter(new FileWriter("C:\\TESTE\\teste.csv")) For that reason: BufferedWriter strW = new…
-
1
votes1
answer954
viewsQ: Archive *.CSV with UTF-8
I created a process that takes the content of a given web page filters what is needed and generates a file *.csv of this content, you work correctly but words that have some accentuation end up…
-
2
votes1
answer67
viewsQ: Code in infinite loop
I developed the following código to take the content of a given web page: import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; Logger logger=…
-
2
votes1
answer56
viewsA: How to copy content from web page with Java?
I managed with the following code to solve my need: URL url = null; File file = new File("C:\\Backup\\page.html"); BufferedWriter outFile = new BufferedWriter(new FileWriter(file)); def x = 1; url =…
-
0
votes1
answer56
viewsQ: How to copy content from web page with Java?
I need to copy the contents of a web page, that according to the Dropdown selected displays the content, are n dropdowns my need would be to copy all content from that page. That’s possible?…