Questions tagged as 'mysql'

3
answers

Select query by age group

I made a query select like this: SELECT data, sexo, idade, count(*) qtd FROM marcacao group by data, sexo, idade And I get a table similar to the table below: DATA | SEXO | IDADE | QTD 01/07/2017 | F | 30 | 3 01/07/20...
asked by 24.07.2017 / 14:21
2
answers

Check if there is a record in the table

I'm trying to check if there is a record in the mysql table using php, I have the table "slug", and in this table I have "id" and "slug_name", as I do to check if there is already a name in this table, for example: noticia_sobre_o_tempo. how...
asked by 24.07.2017 / 15:17
1
answer

How to add a value to the current one in each of the rows of a mysql table?

I have the following table in a mysql database: Iwouldlikeacommandtoruninphpmyadmin,addthecurrentvalueoftherating_sumcolumnto5,andrating_countto1,thus: I want to add these values (5, 1) to all table rows, without any restrictions. I tri...
asked by 16.06.2017 / 04:49
2
answers

How do I list all the fields in a table plus a random value from another table?

I'm having a problem when dealing with two tables, tb_adm_anuncios and tb_adm_anuncio_banner . For each ad I have 4 banners, and to list those ads I need: **Anúncio:** -Nome do Anúncio -Link **Banner:** -Imagem The command...
asked by 27.07.2017 / 16:33
2
answers

How to return some * data with time interval?

I have a monitoring system. Retrieves the user's location every 5 seconds. However, I want to show only the records that appear in the range every 15 seconds (for example). The main idea is that it is dynamic, where the user of the system can ma...
asked by 31.07.2017 / 15:07
1
answer

Error updating AUTO INCREMENT

I have the following code: $sql='ALTER TABLE tributos_prod AUTO_INCREMENT=:ultimo_id'; try { $query_delete=$conecta->prepare($sql); $query_delete->bindValue('ultimo_id', $ultimo_idTP+1, PDO: : PARAM_STR); $query_delete->ex...
asked by 18.07.2017 / 19:46
1
answer

Count only new records in the database and submit as notifications

I have the following question, I need to return in a panel that there are records that are not being displayed on the screen. Type I have 10 records being displayed, are registered 2 more then I need to show a notification similar to that of Fac...
asked by 17.07.2017 / 19:27
2
answers

Add and split results in the same query

How do I resolve this situation? $q = mysql_query("SELECT *, COUNT(*) as total, SUM(bolas_agarradas+bolas_espalmadas) as defesas, SUM(bolas_agarradas+bolas_espalmadas+gols_sofridos) as chances, SUM(defesas / chances) as porcentual ... Use t...
asked by 17.07.2017 / 14:48
2
answers

How to get the value of one table depending on the maximum value of another?

I have the following code that gives me a table like the one in the picture, but my question is how do I get the name and just the name of the one that has the highest health value that will be the gas? Is it possible to use a NOT EXISTS in this...
asked by 17.11.2017 / 18:46
2
answers

Alternative for MySQL Workbench

Well, I currently use the MySQL Workbench software to make my scripts, I wanted a lighter program, does anyone know / could give me some alternatives? I do not want PHPMYADMIN Note: I'm developing with PHP - I do not know if that influence...
asked by 15.03.2017 / 17:05