Questions tagged as 'mysql'

1
answer

How to customize the Auto_Increment numbering in MySQL?

I have a Contrato column in my MySQL database, it is as Auto_Increment, numbering the contracts as 1 , 2 , 3 in> ... But I needed, if possible, to organize these numbers in the actual format of contract numbers. It works lik...
asked by 28.02.2015 / 20:37
2
answers

Normalize comma-separated values for new table

The idea is to stop having the column with the comma-separated values and pass them to an intermediate table: Source table Assuming a table named press with the following fields: id, tag_id Containing records type: ┌───────...
asked by 07.04.2015 / 17:28
1
answer

How to restrict dates in MySQL and SQL Server?

I wonder if I can restrict certain dates in the database itself, not the code. For example, I have a table that records date of entry and date of exit. Here are some requirements. The date of entry can never be greater than the date of ex...
asked by 05.08.2016 / 14:55
1
answer

mysql function do not join the equals

I have this query for MySQL: SELECT email, COUNT(*) AS Vezes FROM automovel GROUP BY email HAVING COUNT(*) ORDER BY 'data_cadastro' ASC It groups all the emails together, and shows how many times they appear. I need to make it just show t...
asked by 08.11.2016 / 21:35
2
answers

What is the use of 'SELECT 1'?

I am making a query using NOT EXISTS in a college job. The situation is as follows: 1.14 - Design the CPF and the amount payable in rents for customers who have rented media and have not yet made any payment. The query performed and...
asked by 02.11.2015 / 00:10
2
answers

INSERT INTO Does not send the data to the database

I have the following code: $con=mysqli_connect("localhost","esferinf_fpessoa","*****","esferinf_factura"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql = ($con, "...
asked by 24.03.2014 / 21:50
2
answers

timediff () limited to 838: 59: 59, how to solve?

DBMS: MYSQL Problem: I am adding HOURS to a TIME field type, and the expected result is above 838: 59: 59, but it is visible only up to this limit. How to solve? SELECT he.empresa, SEC_TO_TIME(SUM(TIME_TO_SEC(CASE WHEN time...
asked by 14.04.2014 / 19:30
2
answers

JOIN with two columns in the same table

Good morning. How do I make a JOIN, two column in the same table? In the quote table, you have the column with the ogirem and destination cpf_cnpj. SELECT cotacao.*, clienteOrigem.ID_Cliente as origemIdcliente, clienteO...
asked by 16.06.2015 / 17:23
2
answers

2 foreign key in one field

Good, I have 3 tables: Athlete Id (Pk) Name AthleteF Id (PK) Name NFed Escorts Id (PK) Name Type Athlete (FK) The Athlete field in the Escorts table is the Id of the Athlete table and the A...
asked by 22.06.2015 / 11:34
1
answer

Why does the primary key group_concat (integers) generate a BLOB as a result?

Trying to answer this issue (such as AP I tried to use group_concat it returns me the object of type BLOB . Table: CREATE TABLE 'teste' ( 'id' int(11) NOT NULL AUTO_INCREMENT, 'nome' varchar(45) DEFAULT NULL, PRIMARY KE...
asked by 14.10.2014 / 12:17