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
-
2
votes1
answer749
viewsHow to get the affected line number in an Mysql Insert
In Sqlserver I use after the insert or update i use: SET @LINHAS_AFETADAS = @@ROWCOUNT So I get the affected line number, I would like to know what the equivalent in Mysql, I searched the web but…
-
2
votes1
answer3770
viewsList tables by foreign key in Mysql
How to identify, by means of an instruction SQL, the tables that relate to another, that is, the tables that have a foreign key that references another table? According to the dummy example, I need…
-
2
votes1
answer715
viewsHow to find an item in a comma-separated field?
I have a field in a table with data separated by comma: id_regioes: 1,2,3,4,5,6. When I do the query "SELECT * FROM `tb_operadora` WHERE `id_regioes` = 1", or "= 6" returns ok, but not when it is in…
-
2
votes0
answers572
viewsSend data by Ajax, query Mysql in background and plot Google Chart with found data
Below I present a step-by-step of what the code I will present already performs correctly. After that I will present the new approach that I would like to use, but which unfortunately is not…
-
2
votes1
answer133
viewsRegistering multiple images in one post
I’m with a study project that has to create a kind of gallery. Assuming I have a limit of 20 images per post. How to register these images in the database? I thought of two hypotheses. In the first…
-
2
votes1
answer156
viewsWhat is more advisable? Perform the query through a list or directly in the database?
I have to perform a consultation where I need to do 4 INNER JOIN and still use WHERE in various fields. What is most advisable? Conduct the consultation in this way? using (DbContexto db = new…
-
2
votes1
answer671
viewsText presentation problem in php with tinymce editor
I have a manager with the HTML editor tinymce, but every time I enter information in the database, when I present it on the page through PHP the text appears without paragraphs and with some tags I…
-
2
votes2
answers438
viewsHow to give ALIAS with current "month/year"?
Considering the query below, I need the ALIAS where there are SOMAS, to be "nomeMes/anoAtual" ("ABR/14","MAI/14"...) dynamically. SELECT fornecedor.codigo, UPPER(fornecedor.razaosocial) AS…
-
2
votes2
answers7215
viewsCreate a column in Mysql that automatically divides the other two column values
People need to explain to me how I can make it similar to what happens in Excel I can create a column in Mysql that divides the values of the other two columns. Something like column 1 / column 2=…
-
2
votes1
answer63
viewsFetch data from Mysql in Postgresql
Is there any way to connect Mysql with Postgresql, so that Mysql DBMS is used but selecting data that is in Postgresql?
-
2
votes1
answer61
viewsHow to list a query without knowing what will be returned?
In this example I defined some attributes to be shown, but in the game I do not know which ones to show because the user is the one who will make the query. <?php while ($row =…
-
2
votes1
answer134
viewsConfigure Relational and Non-relational Databases in the same project with Spring-Data + Hibernate
I am trying to create a Java application where I need to configure two databases: Mongodb and Mysql. My idea is to use Spring-Data with Hibernate for both banks, but I found only tutorials for…
-
2
votes2
answers40109
viewsGet values from one table that are not contained in another
I would like to know how I can get values from a mysql database and the data obtained should be in one table and not in another. For example: I want all equipment (equipment table) that is not…
-
2
votes2
answers170
viewsCheck UNIQUE element before inserting it
I have a table in a Mysql database where one of your fields (email) is UNIQUE, when entering a record I must first perform a select checking if there is a record whose email field matches the email…
-
2
votes0
answers192
viewsIt is possible to delete a file if there is no reference from it in the database using mysql
I wonder if anyone knows any way to create a "trigger" in Mysql that when deleting a table value, delete a file together on the server, for example: Excludes the item from tbl_imagens whose name is…
-
2
votes1
answer119
viewsC# Threads How to optimize a SELECT with BLOB
I have an application in C# (.Net 4.5) that when loading a screen among other operations it looks for a background image and sounds in the database. It happens that for some screens loaded this…
-
2
votes1
answer823
viewsCheck if any Select output line in Mysql contains a value
I would like to know how to check in the Where clause if any of the lines has a certain number. For example: If a select returns 1 2 3 4 and in clause ask the 4 it returns the values, if return 1 2…
-
2
votes1
answer1114
viewsPass results from an array to variables
The query below returns the total number of records by mode: $sql = "SELECT modalidade, COUNT(*) as total FROM a_finan GROUP BY modalidade"; $resultado = mysql_query($sql) or die( mysql_error());…
-
2
votes1
answer2128
viewsError: "Lock Wait timeout exceeded; Try restarting transaction"
I’m developing a java application that uses Hibernate to do the mapping. I created the DAO’s of the classes, but when doing Insert, update and delete operations it returns me this Mysql error.…
-
2
votes1
answer2432
viewsSort at the lowest price in a Mysql table
How to list products that have the lowest price for the highest! From smallest to largest! Using PHP and Mysql.
-
2
votes2
answers153
viewsQueries with various ruby associations on Rails
I want to do in ruby on Rails, this: SELECT * FROM isolateds INNER JOIN genes ON geness.isolated_id = isolateds.id INNER JOIN stats ON stats.gene_id = genes.id INNER JOIN mutations ON…
-
2
votes0
answers755
viewsHow to sync Sqlite with Mysql
I have an application in Ionic and Angular that receives information through a $http. I’d like to know how I keep the information offline of the application updated with those of the Mysql database…
-
2
votes2
answers4080
viewsFill Second Input automatically when First
I have a input I’m going to name input-1, and there I will insert this: 12:00 Having a second input I’m going to name input-2, is possible when inserting into input-1: 12:00 He in the input-2 can…
-
2
votes2
answers1171
viewsCan you use the same query and define two different "ORDER BY"?
I use the following passage for a query to the database $cs1 = $pdo->query("SELECT TITULO, URL, IMAGEM , TEMPO FROM post ORDER BY CLIQUES DESC LIMIT 5")->fetchAll(); I would like to explore…
-
2
votes1
answer1327
viewsHow to "preg_match" only numbers?
My attempt, a failure: $post_id = preg_match("/^[0-9]+$/", $_POST['post_id']); I tried to be a user who changed the id of the post to for example: post_id="43223646", However, when the data is…
-
2
votes2
answers166
viewsInsert the last table data into a second table
I have a problem to give INSERT in PHP. I have a table called products_1 and another one called products_2. Table 1 has the same products as the second one, but with 5 more products, i.e., ID 11,…
-
2
votes1
answer153
viewsUpdate query with select for Procedure
I’m trying to do a query that will enter a previous but I’m not succeeding, the query is like this: UPDATE sca_lotacao AS t0 SET t0.ativo = 0 WHERE ( SELECT * FROM sca_pessoa AS t1 RIGHT JOIN…
-
2
votes1
answer1120
viewsRetrieve data from fields of the same name but from different tables
I have a select that looks for data from three different tables, but has some common fields between these three tables. My question is how to get the data of these fields, which has the common name…
-
2
votes2
answers261
viewsInner Join display last status
I need to get data from 3 tables through a filter in 2 of them using the Date and Status criteria, and the Date is done in one table and the Status in another. It turns out that when more than one…
-
2
votes1
answer1143
viewsGenerate XML from php mysql database after query
How to generate an xml file from a database after a query and then automatically download?
-
2
votes1
answer258
viewsIs it possible to include database versioning in the commit (GIT)?
I wonder if it is possible to versioning the database (in my case Mysql) through GIT, or if there is some other effective way to do it.
-
2
votes1
answer1384
viewsDelphi XE7/XE8 - Refresh in database (real-time update)
I have two interconnected systems, one saves a record in the database and another reads the saved record, currently I use a timer to refresh the database in the system it reads, so it takes every 5…
-
2
votes2
answers401
viewsErro Foreign Key
I’m making a database rather simple for presentation of a work and I’m finding the same annoying problem. In this case we have two tables, funcionario[nome,cpf] and departamento[DNR,CPF do gerente].…
-
2
votes3
answers140
viewsSearch results in 3 tables with the date of the last 5 days
I have the following tables: What I’m trying to do is get the user name that has no record on tbl_votos and no recourse in tbl_recursos in the latter 5 days. I’m using php and mysql.…
-
2
votes1
answer101
viewsHow to remove the red part of the figure?
require("setup_do_banco.php"); $colunas = $pdo->prepare("SELECT * FROM origem WHERE ativado = 1"); $colunas->execute(); while ( $coluna = $colunas->fetchAll(PDO::FETCH_ASSOC) ) {…
-
2
votes2
answers1832
viewsMysql Automatically Change Data
Good afternoon, I wanted to implement a system that would make my database automatically, change the value of one of the fields of an element when the expiration date field was higher than the…
-
2
votes3
answers55
views -
2
votes1
answer404
viewsMysql Insert, Auto Insert?
$insert = mysql_query ( "INSERT INTO analise VALUES ( $analise_hora )" ) ; I am trying to insert this data with this function automatically when the user enters the page, but it is not being…
-
2
votes1
answer594
viewsHow to display related table data organized by topics
I have a question in SQL that is the following: I have two tables, the parent table, and the daughter table, where the daughter table receives the id of the parent table as a foreign key, however, I…
-
2
votes1
answer54
viewsDownload files with Cordova stored in the database
Is there any way to download documents stored in a database mysql, in my aplicativo híbrido cordova?
-
2
votes2
answers461
viewsCompare if there is already a record in BD Mysql
I am creating a room reservation system, and I have the following columns in my table: agenda_id agenda_hora_inicial agenda_hora_final agenda_data_inicial agenda_data_final agenda_sala My question…
-
2
votes1
answer1936
viewsHow to pass data from one table to another in php?
I’m new to programming, and I’m developing an advertising website. And I’m struggling, in my person has the option to publish an advertisement of her. It publishes and is sent to the database, and…
-
2
votes1
answer478
viewsAutomation of registries (Mysql)
Hello, everybody! I have a problem, and I need your help to come up with a solution. My situation is as follows: There is a page . php that will be accessed daily by several people, this page will…
-
2
votes1
answer947
views(Hibernate2) Genericjdbcexception: Could not execute query - Closed session error while browsing the platform
Good afternoon! I have a web application and decided to migrate it to Cloud Google. When I start my Cat, the application runs smoothly, but from a certain time, starts to appear these errors.…
-
2
votes2
answers584
viewsSort by amount of days missing to win
I have this script in my code: $sql = "SELECT * FROM os WHERE status2 <> 'Fechado' ORDER BY XXXXXXX "; $resultado = mysql_query($sql) or die ("Erro na consulta"); while ($linha =…
-
2
votes1
answer81
viewsUPDATE, field with "placeholder query" failed execution
Follows the code: $campo = $_POST['campo']; $valor = $_POST['valor']; $id = $_POST['id']; $mysqli = new mysqli("localhost","root","","tabela"); mysqli_set_charset($mysqli,"utf8"); $consulta =…
-
2
votes1
answer3116
viewsAdd multiple select Count results to MYSQL
I’m wanting to add up all the clients I have on all my bases, so for that I’m doing the following query: SET @total = 0; USE BASE x1; SELECT @total:= @total +COUNT(1) FROM clientes; USE BASE x2;…
-
2
votes0
answers92
viewsError creating and downloading XLS with Cakephp
I have the following code: $this->autoRender = false; $this->autoLayout = false; $turmaId = base64_decode($turmaId); $turma = $this->Turma->find('first',array( 'conditions'=>array(…
-
2
votes1
answer282
viewsHow to change the format of a direct column in Mysql’s LOAD INFILE?
Hello, I have a table 'x', with the column Value, in DECIMAL, in a Mysql 9 database. It turns out I need to import data in csv. I do this using LOAD INFILE. In these Csvs, the value is in comma…
mysqlasked 9 years, 5 months ago Guilherme Duarte 918 -
2
votes2
answers492
viewsMysql due date
I have a register where I store the registration date of the products. However I need to delete these products after 5 days registered in the database. I tried to use the PHP with the following…