Questions tagged as 'mysql'

3
answers

List records that are in a table and those that are not in the same table

I have a dots table and a users table. In points, I have an ID that references the user of the users table. What I need to do is to return all users who hit the point along with those who did not hit the point. So I can see who hit and who did n...
asked by 09.05.2016 / 14:34
1
answer

How to send variable value into class php?

I've been perfecting secure database connection techniques, and got to the script below. <?php class query_sql { protected static $conect; private function __construct() { $mysql_host = ""; $mysql_base = ""; $mysql_user = "";...
asked by 28.09.2016 / 10:44
1
answer

PDO - Problem with FetchAll

Good afternoon, my friends, my problem today is this. I have the following query: set @row_number = 0; SELECT @row_number:=@row_number+1 AS row_number,il.* from itemloja il order by il.LojaId As you can see, there are two that depend. I wan...
asked by 07.01.2016 / 20:54
2
answers

MySQL, help to understand data export

Previously when I exported a database it looked like this: CREATE TABLE 'config' ( 'ID_Config' int(1) NOT NULL AUTO_INCREMENT, 'nome_site' varchar(255) DEFAULT NULL, 'thema' char(50) NOT NULL, PRIMARY KEY ('ID_Config') ) ENGINE=MyISAM...
asked by 05.01.2016 / 18:10
1
answer

How do I get the penultimate item in a string?

I need to get the penultimate name from within a string. For example;    Antonio Alves Ferreira Castro I need the ferreira I know that to get the Castro I can use the SUBSTRING_INDEX(NOME, ' ', -1) I tried -2, but it does not...
asked by 02.09.2016 / 01:03
1
answer

Count records only if greater than the current datetime, with count ()

I have the following query : SELECT u.nome, u.email, u.login, u.data_cadastro, COUNT(*) AS qtd FROM patrocinadores AS p LEFT JOIN anuncios AS a ON a.id_user = p.id_user INNER JOIN usuarios AS u ON u.id = p.id_user WHERE p.id_patrocinado...
asked by 05.12.2015 / 02:39
1
answer

Show the highest value of a field, together with the field name

Hello, I have a huge question. I need to show in my table, on the home page of my site, which field in my table has the highest value and next to this field, show not only the highest value but also the name of the person who has this value....
asked by 01.12.2015 / 01:17
1
answer

Table multiplying the data

Well, I've had this problem for some time and I would like the help of you, I have 3 tables that would be sale, vendaproduto, vendaservico. and I insert the sales table items into the other two tables with the following code: mysql_quer...
asked by 15.12.2015 / 13:47
1
answer

Search by word taking into account relation between 3 tables

I am setting up a search system for a business guide and at the time of searching I am only able to search for a specific word in a table, for example: pizza. But the ideal would be to see if there is a company called "pizza" or if one that does...
asked by 10.03.2016 / 23:27
1
answer

Using multiple group by in a query

I have 3 Tables: Products, Orders and Order Item. Table: Produtos id_produto foto_produto categoria sub_categoria --------------------------------------------------------- 0081 15487.jpg 4 32 0491 1...
asked by 08.12.2015 / 14:37