Questions tagged as 'query'

1
answer

IN clause and a string

Good morning. I am trying to make a query in MySQL given the following cases. Table codings id| nombre ------------------------ 1 | Correo electronico 2 | Videoconferencia 3 | Foro 4 | Otros Table tutorials id|tipo_tutoria ---------...
asked by 22.09.2017 / 13:43
3
answers

Query two records in the same SQL Server table

I would like you to resolve this doubt. I want to make a query of a user table, but I want to do it so that I can display two results, since I want to compare the information of two users. When I make a normal query it would be like this:...
asked by 05.07.2017 / 23:43
2
answers

QUERY SQL - Separate String

I am working with some queries and the need has arisen to have to stay with only a part of a field, that is, I have a field that has a final extension similar to this 13123243534.Consumo and at the same time other values in that Same fiel...
asked by 09.08.2017 / 14:52
1
answer

Problem with a SELECT

I have the following SELECT generated by a JSON array with objects that are hotels. SELECT CONCAT( '[', GROUP_CONCAT(JSON_OBJECT('id', h.hotel_id , 'nom', h.nom, 'estrelles', h.categoria, 'puntuacio', h.puntacio, 'tipus', h...
asked by 16.03.2018 / 11:03
1
answer

MYSQL - problem with ORDER BY of a column of equal values

I have the following MYSQL query: SELECT *, ( SELECT SUM(points) FROM point WHERE employeeId=employee.id ) as totalPoints FROM employee ORDER BY totalPoints DESC As you can see is a simple l...
asked by 15.06.2018 / 21:51
4
answers

Join two SQL queries [duplicated]

I have two tables and two queries for each table A query is SELECT DISTINCT CodContrato, FechaBaja, FechaFin FROM Contrato WHERE (FechaBaja != FechaFin) AND (FechaBaja BETWEEN '20180101 00:00:00' AND '20181231 23:59:59') and the other...
asked by 12.12.2018 / 10:16
2
answers

Query that displays data within a range of dates

I want to display the data in a PDF within a selected date range from datepicker , the PDF is generated and shows the column headers but not the information, it is most likely to be The% co_of% I'm doing. The data that mus...
asked by 12.12.2018 / 18:02
1
answer

Change value of a Select field based on another table

The situation that I present is not explained well. But I have a table of matches with the following fields: Identificador , tipo de deporte , fecha , visitante and local . Visitor and local are type int...
asked by 19.07.2018 / 01:27
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

Put two results together in the same table

I'm trying to get two different queries together in the same table: declare @semana nvarchar(10) set @semana=(select datepart(week,getdate())) select SUM(CANTIDAD) AS Qty1 from tbl_Entrada where dia=('Monday') and semana=@semana...
asked by 03.07.2017 / 22:51