Questions tagged as 'mysql'

2
answers

LIKE does not work together with BETWEEN

Something wrong with this query? All data is displayed without any filtering. But when I shoot the LIKEs it works or if I take the BETWEEN and leave the LIKEs it works. One only works without the other. Why? $produto =...
asked by 02.08.2016 / 23:11
1
answer

Delete Directory Image - Laravel 5.1

I have the following code in my destroy method: try{ Tecnico::find($id_tecnico)->delete(); DB::commit(); return Redirect::back()->with('message', true); }catch (\Exception $e){ DB::rollback(); return $this->ren...
asked by 13.04.2016 / 20:48
4
answers

How to join two rows in SELECT?

I have a problem with joining 2 lines. I researched a lot, but found nothing that could solve my case. In the query below, there are two SELECTs, which return two rows for each extension, as shown below. In the code, I need to merge these two...
asked by 15.04.2016 / 14:18
1
answer

Data Mysql Operations

I would like to know how to do calculations with dates in Mysql. Table: ID | DataValidade (DATETIME) 1 | 2017-01-01 00:00:00 2 | 2017-05-01 00:00:00 3 | 2016-06-01 00:00:00 I need to return records whose expiration date is 30 days fro...
asked by 10.05.2016 / 17:19
2
answers

How to send the result of an email query SHELL SCRIPT

I have the following query: #!/bin/bash db="bats"; table="promotion"; dbHost="192.168.0.246"; dbUser="root"; dbPass="root"; result='mysql -h $dbHost --user=$dbUser --password=$dbPass --skip-column-names -e "SELECT name FROM $db.$table WHERE...
asked by 11.05.2016 / 23:53
1
answer

Table Relationships - how to do

I'm having trouble understanding how to create the relationship of the tables. My scenario is as below: A parceiro can have multiple usuários , but a usuário can only be linked to a parceiro . A usuário can re...
asked by 10.05.2016 / 17:59
1
answer

Insert data in mysql, in a field of type timestamp

How do I enter information in a field of this type? The field name is duration, I would like an example ..     
asked by 28.04.2016 / 01:02
1
answer

Does anyone know why MySQL Select sometimes does not Work?

I'm facing a problem, in which I have a table in the DB and it contains the data. But when I do SELECT , some data it returns and some do not. For example: In the Codigos table I have the following data. |idEquipamento|idCodigo...
asked by 16.09.2016 / 21:55
1
answer

Error connecting to MySQL

I took an example from the internet to connect with MySQL private static final String USUARIO = "root"; private static final String SENHA = "123456"; private static final String URL = "jdbc:mysql://127.0.0.1:3306/aulas"; private static final S...
asked by 17.05.2016 / 15:59
1
answer

Case in mysql - display certain quantity

I'm having a pretty doubt in an sql: The website is divided into 3 categories, each category is highlighted, only the customer asked to limit the amount of product highlighted by category. It would look something like this: I have 100 reco...
asked by 17.03.2016 / 14:32