Questions tagged as 'sql'

1
answer

MYSQL blocks the SELECT when executing an UPDATE in a trigger

This is the error I receive    SQLSTATE [HY000]: General error: 1442 Can not update table 'accounts_cobrate' in stored function / trigger because it is used by statement which invoked this stored function / trigger. If I use a static id i...
asked by 22.03.2017 / 15:19
3
answers

Count rows in with a SQL Server subquery

I have the following query : SELECT DISTINCT NoEconomico ,count(NoEconomico) AS Totales FROM prm_FEMSA_IndicadoresTelemetria WHERE RPMEventos <> 0 AND AccountId = 9159 AND FechaInicio BETWEEN '2016-11-27' AND '...
asked by 22.03.2017 / 19:32
1
answer

How do I consult in a table from a column "json" the rows that contain only one data in that column?

I have a table as follows: CREATE TABLE partes( id INTEGER PRIMARY KEY, id_padre INTEGER, tipos JSON ); I insert the sample data: INSERT INTO partes (id, id_padre, tipos) VALUES (1, 0, '["1","2"]'), (2, 1, '["2"]'), (3, 1, '["2","1"]...
asked by 13.07.2017 / 20:35
2
answers

How to add SQL Server Time field

I am working on a system for a broadcaster, this keeps track of the audio files played on the day, as well as the duration of each audio file. I save this information in a table that has the following structure: ** The description field...
asked by 04.10.2018 / 21:17
1
answer

Use cast for a filter on sql server

select (select NOMCLI from CARROS where cast(IDCLI as int) = idreg1) as NOMCLI, fecha from replog where movimiento = 'ALT' and TABLA = 'CARROS' and usuario = 'sa' I have an example here where idcli is integer: 327 and idreg1 i...
asked by 28.12.2016 / 21:07
2
answers

Group by a field and see all the values of each record - SQL

I need to group by date a table with several dates with a specific value for each date. For example: 01/01/2016 10 01/01/2016 20 01/01/2016 30 02/01/2016 40 02/01/2016 50 ... The result should be: 01/01/2016 10 20 30 02/01/2016 40 50 T...
asked by 09.01.2017 / 20:15
2
answers

Error reading an .sql file

Good evening Community. I have a program in java, which I pass as an argument the authors.sql file (database in postgresql) which contains a single line: INSERT INTO authors VALUES ('CEVA', 'K.', 'Cherteston') At the moment of reading th...
asked by 29.10.2016 / 01:52
2
answers

SQL Contains: Escaping query operators

I had a query running for some time (mounted by JPA) when suddenly I was given an exception:    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.hibernate3.HibernateJd...
asked by 15.09.2016 / 12:17
2
answers

Mysql - How to add two fields with the same name, group them and count them?

Good morning, I hope you can help me with this query, I have this query: SELECT at_ce.condicion, COUNT(*) AS cantidad FROM at_cons_externa at_ce GROUP BY at_ce.condicion And as a result, it gives me this: What I need is to put toge...
asked by 16.06.2016 / 15:19
1
answer

Separate a column in several SQL Server

Does anyone know how to divide a field into several columns? I have an sp, which gives me the following information. I would like to divide the Week field into several columns SemanaAño Semana FechaInicio FechaFin R...
asked by 16.02.2017 / 17:17