Questions tagged as 'sql'

1
answer

Subtraction of 2 sums in sql

I have this query SELECT t.SI_Articulo, m.SI_Descripcion, t.SI_UM, CASE WHEN c.SI_OV IS NOT NULL THEN '*' ELSE NULL END SI_OV, (COUNT(DISTINCT t.SI_Ubicacion)) SI_Ubicacion, (SUM(DISTIN...
asked by 03.07.2017 / 20:04
2
answers

Error programming a JOB in SQL Server 2008

I am programming a JOB ( DEPURACION_TRAMITE ) on a Remote server, I get the following result ( not programmed ) in this field: Next Execution seen from the monitor of JOB's : It's just dead, there are no execution error messages, it...
asked by 16.06.2017 / 00:08
2
answers

inner join without duplicates

I'm doing a system in php in which I have two tables in one save the records and in another the boxes where each record goes, the result is this way -------- -------- --------------- CASILLA SECCION REPRESENTANTE -------- -------- -...
asked by 15.06.2017 / 22:46
1
answer

Select data from a table related to a user

I have these two tables: users: +-----+----------+------------+ | id | nombre | apellidos | +-----+----------+------------+ | 1 | juan | apellido1 | | 2 | pepito | apeliido2 | +-----+----------+------------+ subjects: +----+--...
asked by 03.06.2017 / 19:02
2
answers

Error connecting Java with SQL

I have a problem with this code: CODE package restaurante2; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.Statement; import java.sql.SQLException; //import.java.util.*; publ...
asked by 25.03.2017 / 05:36
2
answers

enter SQL query in an input with PHP

I am trying to query a BDD with php to show the results through an HTML input. To show the result I do the following: while($fila=mysqli_fetch_array($resultados, MYSQLI_ASSOC)){ $emp = $fila['Emp_Nom']; { And I show it through t...
asked by 02.04.2017 / 02:35
1
answer

List data with SQL Prepared Statements

I need to bring the data from the Database using an id. The Users class has the following function: public function getPerfil($id) { $stmt = $this->mysqli->prepare("SELECT id_usuario,nombre,apellido FROM usuarios WHERE id_usuario = ?...
asked by 16.02.2017 / 23:17
4
answers

Check if there is a column in the table and if not create it from PHP

I have the following problem: Check if there is a column with the name that goes through a variable and if not create with the column with the name of the variable. This is what I have tried so far: $talla= "xg"; if ($fila["codigo_articu...
asked by 21.02.2017 / 18:33
1
answer

How can I ignore two results in a specific query?

I have a query that gives me the start and end of each user, but what I want is to omit two users in specific, how can I manage to omit two results? I have the following query: SELECT nombre, MIN(fecha) desde, MAX(fecha) hasta FROM...
asked by 02.05.2017 / 18:58
2
answers

Problems with group concat SQL

From my previous question and with the solution that gave me the sentence worked correctly. This was the correct sentence SELECT valor, group_concat(DISTINCT IF(dia=1, valor_b, NULL)) dia_1, group_concat(DISTINCT IF(dia=2, valor_b, N...
asked by 09.05.2017 / 09:55