Questions tagged as 'sql'

3
answers

SQL query in MySQL between 3 sum and count tables

I have 3 tables. One is clientes , other fotocopias and recargas_saldo , related by id_cliente which is primary key in clientes and foránea in the others. I need to take out the following: 1 .- No...
asked by 17.10.2018 / 13:16
1
answer

I can not modify table record using EF

I have the following table in SQL, which has those 4 data Through EF I am trying to update the records say ID 3 to be "40" but for more I try the amount always remains at zero This is the code I'm using: /*SE AGREGA SALDO AL SALDO...
asked by 25.08.2018 / 11:52
2
answers

Store date and time in variable in a MySQL stored procedure

I have a problem, I am trying to store the current date and time of the server in a variable, within a procedure stored in MySQL, only I can not do it, the previous thing I do, since in multiple rows I will execute a relative condition to the cu...
asked by 07.09.2018 / 22:40
1
answer

SQL Switch assigning value to a variable

I need to go through a whole table and depending on its content insert that data somewhere else that I imagine I could use a switch , but I have problems to reference it to the variable I want. I need to recognize the value of [Charge / Credit]...
asked by 22.08.2018 / 19:46
2
answers

get the number of rows of a sql server base to show in php

I want to see the number of rows in a table in SQL server my sentence is: $result12 = sqlsrv_num_rows($conn, "SELECT asistencia FROM asistencia"); but you are not giving me any results when trying to show it in php, taking 100 results in m...
asked by 30.07.2018 / 18:06
1
answer

SQL query. Joins

Place value of a table2 in a query to table1. I have a query in SQL SELECT ROW_NUMBER() over (partition by IdCertificado order by FechaCambio) Consecutivo, upper (IdCertificado) IdCertificado , IdTipoSolicitud , cast (FechaCambio AS date)...
asked by 31.07.2018 / 21:50
1
answer

help with group by in mysql

I have to take out the total amount for each unit that I have in my table, the problem is that a record that supposedly belongs to unit 3 belongs to unit 1, I do not know how to group it so that it is correct, this is my query. select SUM(TOTA...
asked by 21.06.2018 / 19:38
1
answer

Problems obtaining data when converting an int to a decimal field.

I have a table with two fields, nombre and cantidad de productos , I'm generating an additional field to see the amount of products consumed in 10 months so I'm doing a select like this: select nombre, existencia , cast((ca...
asked by 21.06.2018 / 23:15
1
answer

Problems with Pivot and Join SQL Server

Could someone tell me what I'm doing wrong? All the errors that mark me tell me the same thing    Expecting '(', or SELECT ( select distinct --periodo empleados.idempleado , conceptos.descripcion descripcion, valconceptos.valor, pe...
asked by 19.09.2018 / 02:31
1
answer

export excel with php and sql server

Hi, I would like to export php excel with sql server: The error that is coming to me is this: sqlsrv_query () expects parameter 1 to be resource, string given in sqlsrv_fetch_array () expects parameter 1 to be resource, boolean given in...
asked by 30.06.2018 / 16:48