Questions tagged as 'mysql'

1
answer

Get month from datetime field mysql

Colleagues, I have a table where it has the datetime () field of Mysql. I would like to get a particular month directly from the where clause. By PHP I know how to do it, but how would I do it directly through the query? I tried this way to g...
asked by 03.05.2017 / 20:28
1
answer

How to select records in a table using the present datetime as a reference?

This select returns me the oldest records to future ones. But I wanted to exclude from the results the events that have already passed and display the current event first. SELECT id, programa, descricao,data_hora from wp_programacao whe...
asked by 04.05.2017 / 07:27
1
answer

create trigger mysql

I have two tables: the table requests and the table logs. Users can interact with the requests table, via a php script that runs a query update and updates the status column. I need to create a trigger that, when running this query update, save...
asked by 22.05.2017 / 16:47
1
answer

Finding time in mysql

Colleagues, I have a system from which you are storing users' registration times in the following format in the Mysql database:    11:11:00 (the time can be any other according to the user's registration) However, I created a Cron task...
asked by 22.05.2017 / 21:57
2
answers

Configure Mysql Workbench in docker

I want to set up my workbench so you can connect with mysql that is running on my docker server but when I try to test the connection, always get the following error: IcreatedtheMysqlcontainerusingdocker-compose.Hereistheconfigurationofmydocker...
asked by 05.06.2017 / 03:50
1
answer

Sum of Records per group

I need to add the value field of the table I'm working on, but the sum is done by blocks where the user id is the same. Exemplifying: This is a shopping cart, each record is a product in the cart with the id of the respective customer. Th...
asked by 02.05.2017 / 03:11
1
answer

SELECT following INSERT [duplicate]

I need to enter the latitude of the city, in the latitude of the vessel, so I did it. function cadastrarEmbarcacao($nome, $capacidade, $cidadePartida, $cidadeChegada, $horaViagem, $diaViagem){ $sql = mysql_query("SELECT CID_LATITUDE FRO...
asked by 28.04.2017 / 14:38
1
answer

Query where result equal to any of the values in the list

I have a table of Duplicates that has the referring month as string, (ex: 01/2012, 05/2016 and etc) I need to perform a query between a date range, if the field were DateTime I know that I would just use > = and < = but being a st...
asked by 28.04.2017 / 14:21
1
answer

MYSQL + PHP, How to add items from different SUM () tables?

I have two tables: table_enights | id | descricao | quantidade | | 1 | Maquina Prensa | 1 | | 2 | Maquina Secadora | 2 | table_bom_itens | id | id_itens | codigo | quantidade...
asked by 25.05.2017 / 18:44
2
answers

Join a bunch of selects in one

I have 4 selects to do that I then put in the separate combobox only I want to put everything together in a single has? $sqlq = $pdo->prepare("SELECT * FROM tbl_tipo ORDER BY tipo ASC"); $sqlq ->execute(); $sqlqu = $pdo->prepare("SELE...
asked by 10.05.2017 / 15:57