Questions tagged as 'mysql'

1
answer

ERROR # 1111 - Invalid use of group function (SUM | COUNT)

This query gives me the total attendance of two parliamentary groups (eg PS, PSD) between two dates: SELECT DISTINCT a.partido, (SELECT COUNT(presencas.assiduidade) FROM presencas, reunioes WHERE presencas.assiduidade = 'Presença (P)' A...
asked by 30.08.2017 / 04:15
2
answers

Error in SQL result

Well, this is what I'm doing, I'm having to do a select in a database, where I should look for values that exist between two dates, and that have a specific user. I made the select like this: SELECT * FROM 'tabela' WHERE 'data' BETWEEN 'dataIn...
asked by 31.05.2017 / 21:01
1
answer

subquerie mysql

Personal I have the following structure: CREATE TABLE Cliente ( Id_cliente int NOT NULL, Nome_cliente CHAR(30) NOT NULL, Endereco CHAR(40), Telefone char(12), PRIMARY KEY (Id_cliente) ) Engine=InnoDB; CREATE TABLE...
asked by 09.06.2017 / 02:43
1
answer

Count rows that have the same value in 2 different columns?

Table ID jogada pontos 1 1 3 1 1 1 2 5 1 2 5 1 2 5 3 2 5 3 I wanted to create a query that counts the play lines and sums the total of points,...
asked by 05.06.2017 / 04:03
1
answer

How would the insert be in a table that only has foreign key

I have a user registry and this registration can be done in two ways, through facebook or email. My question would be how to give insert in these table, as I have a control table that gets the ids of the other two tables by foreign key. Table...
asked by 02.06.2017 / 04:16
2
answers

Percentage vote in php within a while

I need to get the votes of the candidates that are in mysql and generate the percentage of votes that each had. How can I view the result since it is within a while? $sql = mysql_query("SELECT * FROM candidatos ORDER BY nome_candidato"); whil...
asked by 18.04.2018 / 00:19
1
answer

Problem Query server has gone away

An error occurred in the Query part mysql_query(): MySQL server has gone away What kind of error is this? Query: $sqlinsert = "INSERT INTO tb_trabalhador VALUES(0,'".$Nome."','".$Morada."','".$Tipo."','".$Email."','".$AlvaraNumero."',...
asked by 03.03.2014 / 18:35
1
answer

Method does not return boolean true even if it is positive

I have a project account that makes a deposit, but I'm not able to return a true even if it finds the value in the database This is my class account method public boolean depositoConta(double deposito) { System.out.println("Metodo de Dopos...
asked by 19.11.2017 / 16:00
1
answer

Close a MySql connection without commit or rollback in C # asp.net

I would like to know what happens in the following scenario: In a program asp.net with c # was opened MySqlConnection , then started a MySqlTransaction , was done insert in the open transaction, however, instead of givi...
asked by 25.02.2014 / 17:51
3
answers

MySQL Workbench - Create Database based on EER Model (Forward Enginner Options)

Doubt: In WorkBench I created the table in EER Diagram and now I want to connect to Hostname 127.0.0.1. The path I make is Forward Engineer - > Next - > and then I have a number of options, do I have to select...
asked by 25.02.2014 / 11:08