Questions tagged as 'mysql'

2
answers

Left Join with multiple fields from the same table

To set up a lease, I have two tables. The first one is the contract, it has some relationship fields like id_locador , id_locatario , id_fiador1 , id_fiador2 , among others. These fields are related to a people table:...
asked by 11.01.2017 / 10:54
2
answers

SQL for last month and last two months

Hello. I'd like some help here. I need to get the records: MySQL Database 1) last month 2) last 2) 3) Current year SELECT id, data, lote, modelo, qtd FROM controle_diario WHERE modelo like ? The table is very simple: id is auto-increment,...
asked by 30.05.2017 / 13:56
1
answer

Decode base64 mysql

I have a database in mysql that some columns of it are base64 encoded. I'm not familiar with programming to develop a script in another language that does the decoding. Is it possible to create a select in sql that decodes the specific columns?...
asked by 04.01.2017 / 18:06
1
answer

MySQL - How to get the name of the table where the result came from? [duplicate]

I have the following code in mysql: (SELECT * FROM entrada WHERE idUsuario = "1") UNION (SELECT * FROM saida WHERE idUsuario = "1") It's all working but I need to know which of the 2 tables came the result, how do I do it?     
asked by 09.02.2017 / 03:12
2
answers

How do I get the difference between working days in MySql?

I wonder if it is possible to calculate the difference between 2 dates by counting business days. In this answer until there is a solution, but from what I saw , the check is only for weekends, if there is a midweek holiday, the deadline wi...
asked by 28.11.2017 / 11:46
1
answer

Get the id of the maximum value

In a Mysql table id valor 1 5 2 15 3 7 I want to get the value of the "id" that has the highest value in the value field. I want it to return the value 2 in this case.     
asked by 24.11.2017 / 20:10
1
answer

Consultation with combined criteria

I'm trying to assign more than one search criteria to the database, and I can not find anything that can help me. I'll explain better: I have a database with a "city" field, where I want the data assigned to that city to be returned. However,...
asked by 23.11.2017 / 15:09
2
answers

Return pre-defined values depending on logical condition

I have the following script of MySQL: SELECT con.id_crecpa, con.id_crecpa, con.descricao, con.diabase, con.dt_emissao, con.dt_quitacao FROM crecpa con INNER JOIN pessoa pes ON con.id_pessoa = pes.id_pessoa INNER JOIN pla...
asked by 12.01.2018 / 23:18
2
answers

PHP MySQL non-functional database

I have a PHP form with a MySQL database generated by phpMyAdmin, however, the bank does not receive the information entered in the form. Follow the form code: <!-- content --> <div class="container"> <div cla...
asked by 24.07.2017 / 14:19
1
answer

Select difficult with date [closed]

I can not do this: how do I return the time in minutes or hours that a particular VALUE occurred in the table below? Example: How long has the VALUE greater than "23" occurred on 05/05/2017? and if you have interval between records? for ex...
asked by 28.07.2017 / 02:39