Questions tagged as 'sql'

2
answers

Update all the columns that have the same name between two tables in MySQL

I have two tables with several column names that look alike and I would like to know how to do UPDATE from one table to another without having to specify all the column names. Let's suppose that I have between the two tables 50 names o...
asked by 27.09.2017 / 12:26
3
answers

how to transpose columns and hide row?

the code I'm using: select ccc.Descripcion AS Grado, p.CodPersona AS Codigo, p.NombreCompleto AS Nombre, cc.Detalle AS Detalle, SUM(cc.Valor) AS Valor from Cuenta cc inner join AlumnoDB.dbo.Alumno a on cc.IdAlumn...
asked by 25.09.2017 / 16:49
1
answer

Subtract variable in a BD - SQL

I have the following question about BD in sql, I have a value and I wanted to know if I can subtract it directly from the variable that is in the DB with a query or I will ask for that value, subtract it and then replace it in my DB.     
asked by 26.07.2017 / 17:49
2
answers

Send variables to SP with foreach

I have a method that reads from a table (X) 3 values and sends them to a StoreProceduces as many times as records have the table (x) so what I do is the following: foreach (var item in resultado) { cmd.Parameters...
asked by 14.08.2017 / 16:49
2
answers

Function group by on column type varchar does not work

I have a query in which I count the rows grouped by a type code varchar should count 1 but count the 3, you could see that it is wrong the grouped column is ID_CURSO_UNICO SELECT count(ID_CURSO_UNICO) as cantidad from encuesta_ap...
asked by 13.08.2017 / 20:01
1
answer

Modify two variables within a THEN

Good afternoon: What I need is the following: Within a CASE , you can manipulate two different variables in the THEN (ex: @var1=a and @var2=1 ) in case the WHEN is fulfilled. I have not been able to do it. I t...
asked by 02.08.2017 / 22:11
1
answer

SQL error: ORA-00904: invalid identifier

I'm starting with SQL and it gives me an error    SQL: ORA-00904: invalid identifier When creating a table with a foreign key that is correctly written. I leave the code in case I have implemented something wrong. Thank you....
asked by 28.07.2017 / 23:09
1
answer

how to ask or check if a query brings a specific data

I have this simple code to enter a system I would like to know if through this same code there is any way of asking if the type of user that I select is administrator, etc. to perform certain actions? this is the code: Private Sub btningres...
asked by 04.08.2017 / 18:09
1
answer

Trigger to subtract dates

Hello colleagues I have this query that works well to find the difference between two dates in days, hours, minutes and seconds but when I pass it to the trigger it does not work anymore I get a number 4873 I do not know what I'm doing wrong, my...
asked by 05.07.2017 / 16:20
2
answers

Sum of times sql server

I want to do a triggers query in SQL Server for the following: A calculated field my column subtracts is the difference between two dates and I want the total column to make me the sum of those differences plus the difference of the previous...
asked by 05.07.2017 / 18:47