Questions tagged as 'sql'

1
answer

Total return of each order with MySQL?

Imagine that I have a pedidos table with the following fields: And that I have two other tables ( pedido_a , pedido_b ) of two distinct types of requests like the examples below: Each item in the pedidos...
asked by 04.08.2014 / 00:43
2
answers

Duplicate column value, how to avoid? [duplicate]

How do I do exactly so that this Valuation value column does not have its values duplicated, ie instead of four result lines there would be only two. SELECT p.nome, d.nome, c.valorAuxilio FROM sca_pessoa p INNER JOIN sca_dep...
asked by 08.04.2014 / 20:27
4
answers

SQL query that meets a parameter that is a set

I have the following situation: in a MEDICAL CONSULTATION I may have one or more SYMPTOMS. So I have a CONSULTA_SINTOMA table, making the connection between CONSULTA and SYMPTOM. A disease can be identified by one or more symptoms, so I have a t...
asked by 06.02.2014 / 14:23
1
answer

Get Gaps in a SQL Sequence

Hello, I have a select today that returns the following result: I make another select that returns a value, 5 for example. I would need to know which numbers are not between the number 1 to the number 5. In my case I would need the foll...
asked by 20.12.2018 / 17:05
1
answer

Group cells case when empty sql

I am making a query in the database to know in which branch the customer paid a portion and what the normal value and interest that was paid. The parcel value is transaction 3 in the bank and the interest amount is transaction 59. Follow t...
asked by 17.12.2018 / 19:45
2
answers

How to give ALIAS with current "mes / year"?

Considering the query below, I need the ALIAS where the SUMS exists, stay as "current / current_name" ("ABR / 14", "MAI / 14" ...) dynamically. SELECT fornecedor.codigo, UPPER(fornecedor.razaosocial) AS fornecedor, FO...
asked by 19.11.2014 / 20:24
1
answer

SQL Help

I have the following problem: I have a XXX table that has the following fields: k803, codrer, period, goal, challenge . Thetableshowsthegoalandchallengeofeach802storerepresentativeintheJanuary2018period.Ineededtomakethemediaofthisstoredurin...
asked by 04.01.2019 / 12:03
1
answer

How do I change 2 or more columns at the same time in Sql Server 2014? (ALTER TABLE / ALTER COLUMN)

How do I change 3 columns at the same time in the SQL SERVER table? I want to change COLLATION , but could be something else. I tried: ALTER TABLE dbo.SIX_POSTO ALTER COLUMN VIS_DS VARCHAR(200) COLLATE Latin1_General_CI_AI NOT NULL...
asked by 04.01.2019 / 21:54
1
answer

Follow the SQL output in Java

My application in java for web gives the error of SQL Syntax several times, but only indicates a trick of the SQL script that gives error. Is there any way I can see the full script that was "played" in MySQL that gave error? Li...
asked by 15.07.2014 / 01:17
2
answers

Stored Procedure with output parameter being the Id of the last insert. W#

Hello, I'm performing an insert into a table, but I need it to return the ID you just entered. I searched the OUTPUT command but could not solve my problem. I need to do all this using procedures, ie I also need to know how to "get" this...
asked by 13.05.2014 / 21:44