Most voted "mysql" questions
Mysql is a relational database management system (RDBMS) that functions as a server, and provides access to multiple users simultaneously. Your source code is available under the GNU General Public License.
Learn more…10,264 questions
Sort by count of
-
1
votes1
answer354
viewsHow to convert mysql search result into columns
Good evening guys, I do not know if someone has been through this, but I need to convert the result of a search in mysql in columns, is not to exchange the rows for the columns, but rather, make…
-
1
votes1
answer212
viewsPHP/Mysql Select total balance of 1 client in the table
My client JOSÉ appears 4 times in this table, and I wanted to take the total of his balance. How do I do this? tabela "clientes" ID NOME SALDO 1 josé 10 1 josé 20 1 josé 30 4 maria 50 5 marta 60 1…
-
1
votes1
answer169
viewsHow to avoid confusion of querys executed at the same time with Php and Mysql?
I have this php function (setBet) that registers the bets in my system based on Betfair, the fact is that I am looking to expand the business and probably some bettor will make a bet at the same…
-
1
votes2
answers348
viewsCheck the number of people per age
How does the consultation to know the total number of people in the age range from 0 to 5 years, and if you do not have any child with a certain age, enter 0; select idade, count(*) as qtd from…
-
1
votes1
answer200
viewsIs it possible to select a table column without entering its name in SQL?
So I was researching but I couldn’t find anything about it, but I need to sort of select the first and second column of the table, without knowing what they are. My code is this: <?php…
-
1
votes1
answer241
viewsHow to insert data using query in a for loop?
I’m trying to insert data into the mysql DB being that some data repeats and others not so who would command the number of executions would be the for, but it is not running the query inside for. I…
-
1
votes1
answer158
viewsHow to Make two or more Select categorized in the same query
I need to take all words with 'A' and play 'Palavrascoma' and all words with 'B' and play Palavrascomb, and can have C, D E... The closest so far was that, but only with the first. SELECT w1.wd as…
-
1
votes2
answers397
viewsHow to convert a Dataset to Int32?
I’m having an information conversion problem that’s coming from my database to a variable of type Int32. When I do the select max(cur_id) from tbl_curriculo; I send the id information directly to a…
-
1
votes1
answer2148
views -
1
votes0
answers57
viewsHow to Dump Mysql command line without Views
Does anyone know how to dump a database in Mysql via the command line without the views, only the database tables?
-
1
votes2
answers1613
viewsLaravel, foreach and database
I have the following table in the database public function up() { Schema::create('cidades', function (Blueprint $table) { $table->increments('id'); $table->integer('uf');…
-
1
votes2
answers1527
viewsHow to treat Queryexception SQLSTATE error[23000]: Integrity Constraint Violation: 1062 Duplicate;
The id is auto increment, but the id_uc is Unique, just not to enter an identical id_uc. I want you to return to view a message. $storm =new ListaStorm(); $storm->id = $id; $storm->id_uc =…
-
1
votes1
answer854
viewsReturn Json using Mysql
I have 3 tables do the Inner Join in them , but I need to return a json, I only managed to return a simple select: My Sql clause: SELECT publicacao.codPublicacao as codpublicacao, usuario.nome as…
-
1
votes1
answer552
viewsHow to load a bar within a Javascript load() bar?
I own a php page index php. that at first loads another php page php page. with a load(): $("#div").load('pagina.php'); On this page I have a loop For with a time consuming sql and I have to show…
-
1
votes1
answer28
viewsUpdate table in wrong format
update table set pontuacao='$var1' where id='1' AND diadojogo > '2017-09-28'; update table set pontuacao='$var1' where id='1' AND diadojogo > 2017-09-28 ; update table set pontuacao='$var1'…
-
1
votes1
answer252
viewsLeft Join with coalesce
I have the following tables setores(idsetor,sigla,ativo) and another with the services executed called ordem_servico(id,numero,idsetor,). I want to count how many services certain sector canceled…
-
1
votes2
answers146
viewsTreating Query Many-to-Many
I got a question about Many-to-Many relationship and I hope I’m not asking a repeated question, but I haven’t found the solution to my doubt in any corner. I happen to have a table of images, a…
-
1
votes1
answer4629
viewsMysql and PHP Search System - List Problems
Hello, good night to all. This is my first question in the forum and I would like to solve a problem with my small web application. This is a work of end of semester of my course, and I need to…
-
1
votes0
answers347
viewsUsing json with PHP and Mysql
Good I’m trying to use to Json to fill out a form with some data, the problem is that I have tried several ways and it still doesn’t work and is that I already have here is a big mess. In First…
-
1
votes0
answers85
viewsTrigger to format date
create trigger tr_Fmt_Data before insert on Tempos for each row set new.Mes = date_format(new.Datas, "%M"); insert into Tempos (Datas) values("2017-10-03"); Would it be possible for you to help me…
-
1
votes2
answers120
viewsHow to perform an "IF" by SQL
Hello, how can I do something similar to an if but by sql? For example: There is a field in the database called dt_ini with no value so far. I’d like to do, "If dt_ini == ' ' Insert into table…
-
1
votes0
answers167
viewsGenerate Reports with large data stream (PHP and Mysql )
I need to generate database reports with a large data stream (between 10 thousand and 150 thousand data), putting this data into a file csv or xlsx (Excel), wanted to know if you have an optimized…
-
1
votes2
answers188
viewsSelect with date returning empty
Good afternoon, What could be wrong in my query that is returning empty because of the date condition. Follows query: SELECT imp_loja AS LOJA, imp_item AS ITEM, imp_desc AS DESCRICAO, imp_dias_giro…
mysqlasked 8 years, 5 months ago Chefe Druida 1,086 -
1
votes1
answer284
viewsBETWEEN with Inner Join does not work
I am having a problem when making a query using between with Internet, the query is simply not working, it returns the results as if the between was not in the query. What I’m doing wrong? SELECT *…
-
1
votes0
answers100
viewsZeos Query freezing the program
I have a system that connects remotely to a server with MySQL on the Web using Zeos, in some cases where the connection usually oscillates, when running the Open in a query, the system freezes,…
-
1
votes2
answers68
viewsCreate more fields and avoid JOIN decreases load?
I have 3 tables that are connected: 1ª tabela: GRADE (grade de horários) Campos: ID - GRADE - ESTADO - VALIDADE 2ª tabela: BLOCOS (blocos de horários da grade) Campos: ID - ID_GRADE - BLOCO -…
-
1
votes3
answers711
viewsSplit form with radios in 2 columns
I have the following form: <?php echo"<form class='form-horizontal' method='POST' action='reposicao.php'>"; echo"<fieldset>"; echo"<legend>OPÇÕES</legend>"; echo"<input…
-
1
votes1
answer45
viewsHow to migrate Posgresql Script to Mysql Script?
I have this database in Postgresql Script, how to convert to Msyql in order to create this database in this database ? -- -- PostgreSQL database dump -- -- Started on 2010-07-03 09:40:14 SET…
-
1
votes1
answer1643
viewsHow to create Server in Postgresql with port other than 5432?
It is possible to create a server within the Postgresql database with a port other than 5432 ? It is possible to have Server1: Postgresql at port 5432 and Server2: Test at gate 5433 ??…
-
1
votes2
answers306
viewsIF condition between Mysql PHP tables
Opa, I have two tables: forma_pagamento and forma_pagamento_selecionada. I have a while where should be listed all forms of payment, so in this while should have a condition IFwhere will return me a…
-
1
votes2
answers225
viewsSelect com group by
I want to group the results that have the same name(varchar) and count the value(int) of the different key_id(varchar). For example, if the records were those: The results would be these…
-
1
votes2
answers1127
viewsValidation Login and Password Primeface and JSF
I have a very simple system of Registration and Login, I made a validation in both fields. I want to adapt this validation to something more specific like: Login does not exist Password invalidates…
-
1
votes2
answers69
viewsList all data from a survey
How to list all the data of this query, I can only show the first line but I want to query all and show them. public function gerarCardapio(){ try{ $cat = "M"; $sql = "SELECT * FROM alimentos WHERE…
-
1
votes0
answers30
viewsData search in a log
I’m having trouble seeing where my mistake is, and also understanding and tidy up the delay of query. I have a function in PHP that makes the parser of a log generated by OpenVpn. Below I will leave…
-
1
votes0
answers116
viewsTakes first SQL Bullider Laravel record
I’m not getting the first record without using foreach query = "SELECT *, (SELECT count(*) FROM corridas c WHERE c.motoqueiro = u.id AND (c.status = 0 OR c.status = 1)) as corrida…
-
1
votes1
answer85
viewsQuery by index in column of type JSON
How to perform a query, by index, where column data is of type JSON? For example: I want to get all data where the voltage is equal to 220: table material id | descricao | extra 2 | Altus |…
mysqlasked 7 years, 1 month ago lucasbento 856 -
1
votes1
answer32
viewsSave column array or multiple records?
I am in doubt of which is the best option in the performance/performance when reading the data. Aiming for one with many records and being accessed all the time. I need to specify which…
-
1
votes2
answers4430
viewsForeign key - Insert table 1 ID into Table 2 PHP/MYSQL
Good afternoon, I am a beginner in programming and I have the following difficulty. I have 2 tables : CREATE TABLE produto( id_produto int(10) NOT NULL PRIMARY KEY auto_increment, nome varchar(45)…
-
1
votes2
answers827
viewsRemove duplicated data and return the highest value date field
We are migrating signatures from an Access database to Mysql, but before migrating I need to process some parts of the data. I need: Remove duplicate id’s Return the highest value of the date field…
-
1
votes0
answers552
viewsHow to put an attribute as a foreign and primary key at the same time?
Utilise Mysql Workbench and I have to represent a DER in the physical model. I come across a specialization: TABELA_PESSOA cpf* nome sexo TABELA_CLIENTE cpf_pessoa* email senha TABELA_FUNCIONARIO…
-
1
votes1
answer311
viewsWHERE clause with PHP-MYSQL array
I have the following code, but it’s not working and I can’t find the error. I need to display the 3 lines (123), which you find in $fetch['list_carac']. <?php include 'conect.php'; $sql = "SELECT…
-
1
votes1
answer38
viewsGet team names on different tables!
Good morning guys, once again I come to ask for a help. I have 3 tables in BD to display name of the teams, location and competition, bringing the results with JOIN this working, but I’m not able to…
-
1
votes2
answers410
views1215 SQL code "Cannot add Foreign key Constraint"
When creating this code always comes the error: 1215 "Cannot add Foreign key Constraint" I’ve tried everything, checked the foreign key restrictions and nothing. Someone can help me? create table…
-
1
votes1
answer519
viewsWhat is the correct way to save an IP in the database?
How to save both IP types IPV4 and IPV6 in a Mysql database? What is the correct typing and column size? Any other remarks? I receive the IP through the $_SERVER['REMOTE_ADDR'] with PHP.…
-
1
votes0
answers410
viewsStore array in database and recover using one of the array information
I need to develop a system where I capture the selected data from a checkbox and insert everything into a array, I believe this is the most appropriate method for storing, and then send it to the…
-
1
votes3
answers465
viewsColumn 'Activocirculation total' cannot be null
I’m finding it very strange what’s happening because yesterday worked perfectly! I created the following code: require_once 'credenciais.php'; //pega dados do formulário de ativo e passivo…
-
1
votes1
answer117
viewsRetrieve dynamically generated checkbox values
I have a form that has some checkboxes with city names that are generated dynamically by PHP. I’d like to know how to get these values and what kind of structure to store them (Array?) and what kind…
-
1
votes1
answer164
viewsSearch in mysql by Javascript
Good morning, I’m trying to make a check if the typed Cpf already exists in the bank, I’m using Portable, could someone help me in this function please? In my controller I search and list all the…
-
1
votes1
answer68
viewsError trying to insert information into mysql database
I have the following tables Produto { idproduto nome preco } Promocao { descricao datainicio datatermino id_produto_fk } When trying to insert a new promotion returns me the following error:…
-
1
votes2
answers245
views