Questions tagged as 'sql'

1
answer

Delete repeated records in a select in Mysql

I have the following select SELECT correo_persona FROM tb_extintores INNER JOIN tb_cliente_normal ON rut_cliente = rut_persona WHERE fecha_vencimiento BETWEEN '2018-09-11' AND '2018-12-11' that brings back customer emails. but sometimes the...
asked by 29.11.2017 / 17:22
1
answer

How to call a stored procedure inside another

As I can solve this problem, I am trying to call a stored procedure inside another, this is the code that I have done so far, in the first image the stored procedure works (SP_SELECTINVENTARIO) in the second is the problem that I have , how can...
asked by 17.11.2017 / 19:15
3
answers

Replace data in a MySQL column

I have the following table Computers I want to replace only the department column with a text string. And I am using the following query: UPDATE computers SET departamento = REPLACE (departamento, (1), "Administración"); UPDATE...
asked by 22.11.2017 / 17:42
1
answer

Why does not this sql query work for me?

The first_advisory column is of type DATE, I put an image of the records entered so far: Making this query: SELECT primer_aviso FROM tabla_principal WHERE 'primer_aviso' < '2017-12-01' Is not it supposed that only records that a...
asked by 18.12.2017 / 18:30
1
answer

Calculate the difference between hours in SQL

How do I get a difference between two hours? For example, between 07:30 and 09:00 , so you can tell me the difference in minutes, seconds and hours.     
asked by 05.11.2017 / 08:43
1
answer

Execute AND statement dependent on a value of a variable

In a stored procedure I want to add an AND statement to the query depending on the value of a variable. DECLARE @name as varchar(50) SET @name = '' SELECT * FROM Tabla T WHERE T.campo = 'valor' Here I would like to add an AND statement to t...
asked by 18.12.2017 / 19:25
2
answers

SubConsulta separates me sql sever data

I have my query: select (select SUM(cco.Valor) from Temp t where t.cod = cco.cod and cco.costo = 1 )as uno, (select SUM(cco.Valor) from Temp t where t.cod = cco.cod and cco.costo = 2 )as dos, (select SUM(cco.Valor) from Temp t where t.cod = cc...
asked by 03.11.2017 / 15:05
2
answers

instance running with data distributed on multiple disks

I have a hard drive that is filling up and I'm going to add another one. On that hard drive I have a MySQL DB and I want to know if placing another HD can, with that same instance of MySQL, store tables on the new disk, or if I have to have 2 in...
asked by 30.10.2017 / 10:46
2
answers

SQL Server, inner joins

I have a question with an SQL server query. I explain: What I would like to know is if there is the possibility of conditioning a search according to a field. I would like something like this: SELECT * FROM prestamos pre INNER JOIN poliz...
asked by 09.11.2017 / 18:27
2
answers

Do you know if something is done in the DB from the program? [closed]

I want to detect when a record is made in my database, that at the database level is a trigger but at the programming level, how could I verify if a certain insert was just made in a certain table? I work with JAVA (version 8), SQL SERVER 2014 a...
asked by 28.08.2017 / 00:18