Questions tagged as 'query'

4
answers

NULL the duplicate values of a LEFT JOIN Msql query

I have 2 tables. The first returns the order number and the two-state times Pedido TiempoPreparar TiempoAsignar ------------------------------------------- P001 10 9 P002 20 5 P003...
asked by 03.05.2018 / 19:21
2
answers

Remove duplicates ... under certain guidelines

I have a table Peticiones whose design is: NPeticion - nvarchar FechaApertura - date TipoPeticion - nvarchar FechaResolucion - nvarchar ... (más campos, irrelevantes para este asunto) The question is that I try to make a q...
asked by 12.04.2017 / 13:12
1
answer

Order query (1,2,3,1,2,3.1 ...)

How about I have a table students with a column called " id_schools " in Mysql I want it is to make a "select" that throw me the results ordered as follows: nombre_a id_escuelas --------- ------------- Juan...
asked by 08.05.2018 / 18:03
1
answer

Efficient Query Group by, Having - SQL Server

I have the following query : SELECT S.IdCliente ,S.NOMBRE ,S.JLI_SDESLINEA ,S.JCA_SDESCATEGORIA ,SUM(S.MONTO) AS MONTO ,COUNT(*) AS QTY ,S.DIA ,T.IDTERRITORIO ,T.VENDEDOR ,T.SUPERVISOR ,V.IDCLIENTE FROM...
asked by 10.08.2017 / 23:53
1
answer

Doubts about an update using prepared statements

$username=$_POST["username"]; $email=$_POST["email"]; $sex=$_POST["sex"]; $description=$_POST["description"]; $infoVisivility=$_POST["infoVisivility"]; The thing is that I collect the above data from a form for the user to...
asked by 28.08.2018 / 05:18
2
answers

How can I sort this table mysql

I have the following table where I sort by prioridad and id_agenda , the order should be as follows Priority ASC and id_agenda DESC (In case a data does not have priority so it must go below the if it has priority). sql...
asked by 26.10.2018 / 14:33
2
answers

Query works but PHP does not return the values

Hello, I am making a request to searchRand.php, in the php I make a query to obtain data. And I save it in the $ to_return variable. But when returning the value of $ to_return does not return anything. Being in the php command print the variabl...
asked by 15.11.2018 / 10:42
2
answers

Group and have the data with the autoincremento mayor- SQL

I need to search in a database like this, where "id" is the variable with autoincrement: id device 6 1 5 1 4 2 3 2 2 1 1 1 I need to sort by "device" but it gave me when "id" is minimal, I need to group w...
asked by 24.10.2018 / 02:57
1
answer

Count null and not null fields, grouping by another field

I am building a query that tells me the number of fields that are null and the number of fields that contain some content. Data . This is my table: CREATE TABLE opciones ( ID int(11) NOT NULL, id_pregunta int(50) D...
asked by 22.02.2018 / 00:28
2
answers

Last record of fields that have the same date MYSQL

I have the following MySQL query: select * from venta as v, pago_venta as pv where pv.pv_fecha in (SELECT MAX(pv_fecha) FROM pago_venta as p GROUP BY ven_id ) AND v.ven_id = pv.ven_id AND v.ven_cliente= 'Amaia Valentina Cardenas Gonzales' T...
asked by 22.08.2017 / 17:24