Questions tagged as 'sql'

1
answer

Subtraction between two fields of same value does not give zero- SQL Server

Someone could explain me: I made a join between two tables. Both bring the same value in their fields. And when I subtract one value minus the other, it does not give zero. How is this possible? E1_SALDO = 990,42 BAIXZ0 = 990,42 SUBTRACA...
asked by 09.10.2018 / 15:13
1
answer

Average Cost SQL

Hello. I need to present the average cost, the lowest cost and the highest cost of all products and still present the total of products checked. The table I have is this: Does anyone know how I generate this?     
asked by 09.10.2018 / 02:45
1
answer

Select where month name appears

Good afternoon, Currently I am developing an app where I list the month and sum of the consumption of each month in KW as shown in the print below: I just do not know how I would do to instead of listing the number of the month it appears...
asked by 30.07.2018 / 20:23
1
answer

How to create a Trigger in MySQL with more than one cursor

I'm trying to update two tables using the same trigger, however it only updates the sales table, but no errors occur. Here is the code: DELIMITER $$ CREATE TRIGGER depoisInsertNotas AFTER INSERT ON notas FOR EACH ROW BEGIN DECLARE done B...
asked by 24.07.2018 / 21:43
1
answer

Query Result to be Zero

Good afternoon, I have a question, could you help me? ... What happens is: I have a sql query that brings me the total amount of sms sent per month and year, but I wish when I did not get that month it shows zero in the field. because i...
asked by 26.07.2018 / 22:33
1
answer

Select does not return repeated based on a column

I came across a situation where I have a client registry that can have more than one address in the related tbEndereco table and an address can belong to more than one client. But when I query clients I need to return only 1 of those addresses,...
asked by 25.07.2018 / 12:31
1
answer

Data manipulation on schedule or bank [closed]

Assuming I need to do the manipulation of a given example I get the weight and height of a user. I want to calculate her BMI to insert into the database. This BMI calculation must be done in a function in the code, or by a trigger in S.G.B.D...
asked by 01.11.2018 / 18:09
1
answer

Perform two COUNT with INNER JOIN

By using the SQL below to count the number of brokers in a table using INNER JOIN , it works perfectly. SQL: SELECT conta.acesso, count(corretor.cod) as num_corr FROM conta INNER JOIN corretor ON conta.i...
asked by 13.07.2018 / 16:38
1
answer

SQL Server - Trigger does not execute after a given field

I have the trigger below: CREATE TRIGGER AtualizaDataAlteracaoSegmentos ON dbo.Segmentos AFTER INSERT,UPDATE AS BEGIN Begin tran update Segmentos set DataAlteracao = GETDATE() where Id = (select ID from inserted);...
asked by 17.07.2018 / 19:16
1
answer

How to transfer data from one table to another on different servers

I need to copy the records of a table that is in a MySQL linked server to SQL Server, ie transfer the records from one server to the other. Could someone give me a way to do this through a query ?     
asked by 17.07.2018 / 19:29