Questions tagged as 'mysql'

2
answers

Java Timestamp and MySQL Timestamp

Problem: I am storing a timestamp in MYSQL, but when I redeem this timestamp I am losing the thousandths. Java timestamp with thousandths. MYSQLtimestampwithoutthousandths. Why does this occur? How to solve this? I need the return...
asked by 19.08.2014 / 16:15
2
answers

Return all data from the first to the last day of the month with mysql

I'm doing a search on a table in my database that needs to return all the data that was created in the current month (I'll run a cron on the last day of the month at 11:00 PM). I have in my table a created_at field that stores the date entered...
asked by 22.08.2014 / 18:10
1
answer

Why when using ON DUPLICATE KEY UPDATE or REPLACE, do we have change in 2 lines?

Example When you execute any of the 2 commands, the message is returned:    2 row (s) affected Query : ON DUPLICATE KEY UPDATE : INSERT INTO 'banco'.'tabela' ('id', 'resumo', 'descricao', 'grupo', 'solicitante') VALUES ('1...
asked by 13.09.2018 / 12:09
1
answer

Add all the results of a table and separate by day / month

I have a table, where I would like to add all the results and separate them by Day / Month. 01/Abril = 3 Resultados; 03/Abril = 5 Resultados; 02/Maio = 1 Resultado; The table I'm using. **ID -- item_data** 01 || 2018-...
asked by 12.04.2018 / 03:31
1
answer

FOUND_ROWS () of MySQL is a function that runs in relation to the local or global session?

I do not understand much of this MySQL session question, however to solve a need I had to use the command FOUND_ROWS() , my query looked like this: SELECT * FROM LICENCAS where FK_PEDIDO = 9479174 AND LICENCA_DATA_EMISSAO BETWEEN '2018-0...
asked by 27.03.2018 / 15:42
1
answer

AngularJS with Socket.io and MySQL data

The following query in cidade.php looks up how many requests are open in a particular city, which blocks a link. If it is 0 , the sum of query frees the link. If it is greater than 1 it blocks the link. Angular Control...
asked by 25.10.2014 / 17:39
1
answer

How to delete a foreign key MySql

I'm having the same problem in all databases. I have a database created with the following lines create database nova; create table estado( id int primary key auto_increment, nome varchar(20) ); create table pessoa(...
asked by 04.06.2018 / 12:49
1
answer

FULL OUTER JOIN generates errors

I'm trying to run the following MySQL script SELECT 'AccessDayClass'.'total' AS 'em aula', 'AccessDayNotClass'.'total' AS 'em casa', 'AccessDayClass'.'DateOnly' AS 'week' FROM 'AccessDayNotClass' FULL OUTER JOIN 'AccessDayClass' ON 'Ac...
asked by 19.06.2018 / 00:31
1
answer

Why in PHP and MySQL! is converted to 0 in some cases?

The question is the title alone, in PHP we can do: var_dump((int) "!"); And receive int(0) . And in MySQL we can do: SELECT campo_int FROM tabela WHERE campo_int = "!" And if that 'campo_int' is '0' it returns th...
asked by 09.11.2017 / 16:55
2
answers

How to calculate the time difference in MySQL?

How to calculate the difference of hours in MySQL ?     
asked by 18.06.2014 / 15:14