Questions tagged as 'sql'

1
answer

I will be able to do in my query a SELECT with a date range according to the current month

I have the following query: $analisis = "SELECT usuario, users.nombre AS 'nombre', users.email AS 'email', SUM(monto) AS 'monto_total', COUNT( usuario ) AS 'num' FROM pedidos...
asked by 20.11.2018 / 16:02
2
answers

SQL Errror in group by [duplicate]

Hello friends, I'm trying to run the following query select x.[Nombre de empleado],x.[Sueldo diario],x.[Sueldo integrado],x.Total,x.conteo from( select em.nombreLargo [Nombre de empleado], em.sueldoDiario [Sueldo diario], em.suel...
asked by 31.10.2018 / 18:43
1
answer

Count or Account and add in a SELECT MySQL

A few days ago I solved a problemon to list a query result but stop the counter and start it again in the same query ... Count or Account in a SELECT MySQL in fact I wanted to reach this result (stopping at 4) Carolina Claudia Da...
asked by 30.10.2018 / 20:17
1
answer

APS.NET MVC stored procedure that returns an array

How can I create a stored procedure that shows me employee deductions I need a result like this: where it shows the uniform deduction This is the table employees is the table deductions this is the Deductions Detail table...
asked by 19.10.2018 / 22:58
2
answers

Show last record entered, if it appears repeated

Today I bring a question about How to make a query? It turns out that I have a table called x, which has 3 or more records (ID, MAC, DATE_CREATION). Now I want to make a SELECT which selects a range of dates eg SELECT ID, MAC, FECHA_CRE...
asked by 25.10.2018 / 18:12
1
answer

How can I get a cumulative column that depends on conditions?

I need to find a way to get an accumulated for each of the records (my query currently returns the records per day), I have something like this: SELECT DATEPART(DAY, r.entrega) AS dia, SUM( CASE WHEN (r.tipo = 1 AN...
asked by 25.10.2018 / 19:29
1
answer

Only one expression can be specified in the select list when the subquery is not introduced with EXISTS

This is my query ... DECLARE @fecha0 datetime SET @fecha0 = (select top 1* FROM events WHERE plate like '%D7Z716%' AND CONVERT(varchar, received, 103) = CONVERT(varchar, GETDATE(), 103) AND ADDRESS LIKE '%W BAYER%') IF EXISTS...
asked by 26.10.2018 / 20:28
2
answers

How to customize the order of the results in MYSQL

I have a table where I keep the post of a forum I did with PHP and Mysql: CREATE TABLE 'sala_muro_temas' ( 'Id' int(11) NOT NULL AUTO_INCREMENT, 'categoria' int(11) DEFAULT NULL, 'id_clase' bigint(20) DEFAULT NULL, 'id_autor' bigint(20...
asked by 12.10.2018 / 22:46
2
answers

How to concatenate a varibale int and str in a trigger?

I'm doing a trigger in sql which concatenates a word with a number, so this is: create or replace trigger TG_curso_Auto before insert on cursos for each row declare var int; begin select count(*)+1 into var from cursos; :new.siglas :...
asked by 10.11.2018 / 04:26
2
answers

Error updating 2 columns of different tables by means of a JOIN

I have the following query with which I try to update the name of the user and the name of the post associated with that user UPDATE users JOIN posts ON (users.id = posts.user_id) SET users.nameUser = "mas blabla", posts.namePost =...
asked by 12.11.2018 / 07:15